Exploiting Tools
AWS हैकिंग सीखें और अभ्यास करें: HackTricks प्रशिक्षण AWS रेड टीम विशेषज्ञ (ARTE) GCP हैकिंग सीखें और अभ्यास करें: HackTricks प्रशिक्षण GCP रेड टीम विशेषज्ञ (GRTE)
Metasploit
शैलकोड
GDB
इंस्टॉल
पैरामीटर
निर्देश
आप वैकल्पिक रूप से इस GEF का उपयोग कर सकते हैं जिसमें और रोचक निर्देश शामिल हैं।
ट्रिक्स
GDB समान पते
जब आप GDB को डिबग कर रहे होंगे तो GDB के पते थोड़े भिन्न होंगे जो बाइनरी ने जब चलाया जाता है उससे। आप GDB को ऐसे ही पते दिला सकते हैं:
unset env LINES
unset env COLUMNS
set env _=<path>
बाइनरी के पूर्ण पथ डालेंउसी पूर्ण पथ का उपयोग करके बाइनरी का शोषण करें
GDB का उपयोग करते समय
PWD
औरOLDPWD
समान होना चाहिए जब आप बाइनरी का शोषण कर रहे हों
फ़ंक्शन कोल करने के लिए बैकट्रेस
जब आपके पास एक स्थायी रूप से लिंक किया गया बाइनरी होता है तो सभी फ़ंक्शन उस बाइनरी के होंगे (और किसी बाहरी पुस्तकालय के नहीं)। इस मामले में बाइनरी द्वारा अनुसरण किया जाने वाला फ्लो निश्चित करना मुश्किल होगा उदाहरण के लिए उपयोगकर्ता इनपुट के लिए पूछने के लिए।
आप आसानी से इस फ्लो को पहचान सकते हैं गेबी के साथ बाइनरी को चलाकर जब तक आपसे इनपुट के लिए पूछा जाता है। फिर, इसे CTRL+C के साथ रोकें और फ़ंक्शन कोल करने के लिए bt
(बैकट्रेस) कमांड का उपयोग करें:
GDB सर्वर
gdbserver --multi 0.0.0.0:23947
(IDA में आपको लिनक्स मशीन में executable का पूर्ण पथ भरना होगा और विंडोज मशीन में)
Ghidra
स्टैक ऑफसेट खोजें
Ghidra बहुत उपयोगी है ताकि आप **लोकल वेरिएबल्स की स्थिति के बारे में जानकारी के कारण एक बफर ओवरफ्लो के लिए ऑफसेट खोज सकें।
उदाहरण के लिए, नीचे दिए गए उदाहरण में, local_bc
में एक बफर फ्लो दिखाता है कि आपको 0xbc
का एक ऑफसेट की आवश्यकता है। इसके अतिरिक्त, अगर local_10
एक कैनरी कुकी है तो यह सूचित करता है कि इसे local_bc
से ओवरराइट करने के लिए 0xac
का एक ऑफसेट है।
ध्यान रखें कि RIP को बचाया गया पहला 0x08 RBP से संबंधित है।
qtool
GCC
gcc -fno-stack-protector -D_FORTIFY_SOURCE=0 -z norelro -z execstack 1.2.c -o 1.2 --> सुरक्षा के साथ कंपाइल करें नहीं -o --> आउटपुट -g --> कोड सहेजें (जीडीबी इसे देख सकेगा) echo 0 > /proc/sys/kernel/randomize_va_space --> लिनक्स में ASLR को निष्क्रिय करने के लिए
एक शेलकोड को कंपाइल करने के लिए: nasm -f elf assembly.asm --> ".o" लौटाएगा ld assembly.o -o shellcodeout --> एक्जीक्यूटेबल
Objdump
-d --> एक्जीक्यूटेबल खंडों को डिसएसेंबल करें (कंपाइल किए गए शेलकोड के ऑपकोड देखें, ROP गैजेट्स खोजें, फ़ंक्शन पता लगाएं...) -Mintel --> इंटेल सिंटैक्स -t --> सिम्बल्स तालिका -D --> सभी डिसएसेंबल करें (स्थायी चर का पता) -s -j .dtors --> dtors खंड -s -j .got --> got खंड -D -s -j .plt --> plt खंड डिकंपाइल -TR --> रीलोकेशन्स ojdump -t --dynamic-relo ./exec | grep puts --> "puts" का पता बदलने के लिए objdump -D ./exec | grep "VAR_NAME" --> एक स्थायी चर का पता (ये डेटा खंड में संग्रहित होते हैं).
Core dumps
मेरे प्रोग्राम शुरू करने से पहले
ulimit -c unlimited
चलाएंsudo sysctl -w kernel.core_pattern=/tmp/core-%e.%p.%h.%t
चलाएंsudo gdb --core=\<path/core> --quiet
चलाएं
More
ldd executable | grep libc.so.6 --> पता (यदि ASLR है, तो यह हर बार बदल जाएगा) for i in `seq 0 20`; do ldd <Ejecutable> | grep libc; done --> पता बहुत बार बदलता है या नहीं देखने के लिए लूप readelf -s /lib/i386-linux-gnu/libc.so.6 | grep system --> "system" का ऑफसेट strings -a -t x /lib/i386-linux-gnu/libc.so.6 | grep /bin/sh --> "/bin/sh" का ऑफसेट
strace executable --> एक्जीक्यूटेबल द्वारा बुलाए गए फ़ंक्शन rabin2 -i ejecutable --> सभी फ़ंक्शनों का पता
IDA
रिमोट लिनक्स में डीबगिंग
IDA फ़ोल्डर के अंदर आप उन binaries को पा सकते हैं जो लिनक्स के अंदर एक binary को डीबग करने के लिए उपयोग किया जा सकता है। इसे करने के लिए linux_server
या linux_server64
binary को लिनक्स सर्वर के अंदर ले जाएं और उसे उस फ़ोल्डर के अंदर चलाएं जो बाइनरी को रखता है:
तो, डीबगर कॉन्फ़िगर करें: डीबगर (लिनक्स रिमोट) --> प्रोसेस ऑप्शन्स...:
AWS हैकिंग सीखें और प्रैक्टिस करें: HackTricks प्रशिक्षण AWS रेड टीम एक्सपर्ट (ARTE) GCP हैकिंग सीखें और प्रैक्टिस करें: HackTricks प्रशिक्षण GCP रेड टीम एक्सपर्ट (GRTE)
Last updated