本文へ移動
cccskills
無料GitHub で公開

elf-static-analysis

ELF binary statik analiz — file, strings, objdump, readelf, nm, Ghidra workflow

インストール方法を見る

含まれるファイル(1)

  • SKILL.md7.4 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

ELF Binary Statik Analiz

Bu skill bir ELF binary aldığında ilk yapılacakları ve derinlemesine analiz metodolojisini kapsar. Hızlı triage'dan Ghidra decompile akışına kadar adım adım yol gösterir.


1. İlk Triage (file → strings → checksec → ltrace/strace)

Yeni bir binary geldiğinde HEMEN şunları çalıştır:

# 1. Dosya tipi
file ./binary
# Örnek çıktı: ELF 64-bit LSB executable, x86-64, dynamically linked, stripped

# 2. Temel string taraması
strings ./binary | grep -i flag
strings ./binary | grep -E 'HTB{|CTF{|flag{|picoCTF{'
strings ./binary | head -60    # ilk 60 satır genel bağlamı verir

# 3. Güvenlik flag'leri
checksec --file=./binary
# PIE, RELRO, Canary, NX kontrol et

# 4. Dinamik bağımlılıklar
ldd ./binary
file ./binary | grep -o "interpreter.*"

# 5. Hızlı çalıştırma (sandbox'ta)
strace ./binary 2>&1 | head -30   # syscall akışı
ltrace ./binary 2>&1 | head -30   # kütüphane çağrıları

Triage Sonucu Yorum Tablosu

ÇıktıAnlamSonraki Adım
UPX compressedPacker varupx -d ./binary
strippedSembol yokGhidra/IDA + manual rename
statically linkedldd çalışmazreadelf -d, strings daha önemli
PIE enabledRastgele adresGDB set offset
string içinde flagÇok kolayDirekt teslim et

2. objdump / readelf Cheat Sheet

# Tüm section header'ları listele
readelf -S ./binary

# Sembol tablosu (stripped değilse)
nm ./binary
nm ./binary | grep -i main
nm ./binary | grep -i ' T '   # text (kod) sembolleri

# Disassembly — main fonksiyonu
objdump -d ./binary | grep -A 100 '<main>:'

# Belirli section'ı disassemble et
objdump -d -j .text ./binary | less

# Tüm binary disassembly (büyük dosyalarda dikkatli)
objdump -M intel -d ./binary > /tmp/binary_asm.txt

# Header bilgileri
readelf -h ./binary       # ELF header
readelf -l ./binary       # Program headers (segment'lar)
readelf -d ./binary       # Dinamik bölüm

# GOT/PLT adresleri (dinamik bağlantılı)
objdump -d -j .plt ./binary
objdump -R ./binary       # relocation tablosu

# .rodata içindeki stringler (sabit veri)
objdump -s -j .rodata ./binary

# Hex dump — belirli section
readelf -x .rodata ./binary
readelf -x .data ./binary

3. HTB PackedAway: UPX Tespiti ve Çözme

Challenge Özeti: Binary çalışmıyor, strings boş, şüpheli.

# Adım 1: Packer var mı?
file ./packed_binary
# "UPX compressed" görürsen veya:
strings ./packed_binary | grep -i upx
# "UPX!" magic bytes ara

# Adım 2: Entropy analizi (packer'ı doğrula)
python3 -c "
import math
data = open('./packed_binary','rb').read()
freq = {}
for b in data:
    freq[b] = freq.get(b,0) + 1
entropy = -sum((c/len(data))*math.log2(c/len(data)) for c in freq.values())
print(f'Entropy: {entropy:.2f}')
print('Packer şüphesi: YÜksek' if entropy > 7.0 else 'Normal')
"

# Adım 3: UPX çöz
upx -d ./packed_binary -o ./unpacked_binary
# veya
upx -d ./packed_binary    # yerinde çözer

# Adım 4: Çözülmüş binary'ye tekrar triage
file ./unpacked_binary
strings ./unpacked_binary | grep -i flag

# HTB PackedAway çözümü:
# strings sonrası doğrudan flag görünüyordu → HTB{...}

UPX magic bytes bozuksa (CTF trick):

# Binary'yi hex editor ile aç
xxd ./packed_binary | head -5
# "UPX!" yerine değiştirilmiş magic → elle düzelt
python3 -c "
data = bytearray(open('./packed_binary','rb').read())
# UPX magic restore
idx = data.find(b'UPX')  # veya manuel offset
# data[idx:idx+4] = b'UPX!'
open('./fixed.bin','wb').write(bytes(data))
"
upx -d ./fixed.bin

4. LACTF glottem: Polyglot Script Analizi

Challenge Özeti: Dosya hem shell script hem Node.js olarak çalışıyordu.

# Adım 1: Dosyayı gerçekten incele (file komutu yanıltabilir)
file ./glottem
head -10 ./glottem    # ilk satırlar kritik

# Adım 2: Polyglot tespiti — aynı anda iki dil
# POSIX shell'de geçerli + Node.js'te geçerli bloklar ara
grep -n "eval\|require\|#!/" ./glottem

# LACTF glottem yapısı:
# #!/bin/sh
# # Node.js bu kısmı yorum sayar ama sh çalıştırır
# ...
# js kodu buraya (sh yorum satırlarının arkasında)

# Adım 3: Her yorumlayıcıda ayrı ayrı çalıştır
bash ./glottem
node ./glottem

# Adım 4: Validator mantığını izole et
# Node.js katmanını çıkar
node -e "$(tail -n +5 ./glottem)" 2>&1

# LACTF çözümü: z3 ile validator bypass → bkz. z3-constraint-solving SKILL.md

5. Ghidra Temel Workflow

1. Ghidra aç → New Project → Import File → Binary seç
2. Auto Analysis → Tümünü kabul et (özellikle "Decompiler Parameter ID")
3. Symbol Tree → Functions → main'i bul
4. Decompiler penceresinde C kodu oku
5. Şüpheli fonksiyon isimlerini ara: check, validate, compare, strcmp

Kritik kısayollar:
  L     → Rename (sembol adlandır)
  ;     → Comment ekle
  Ctrl+E → Edit Function Signature
  G     → Go to address
  Ctrl+F → String/symbol ara
  Space  → Listing ↔ Decompiler geçiş

String'den geriye git:
  .rodata içindeki string'e çift tıkla
  → References → Show References to Address
  → Kullanan fonksiyonu bul

6. Otomatik Triage Bash One-Liner

#!/bin/bash
# Kullanım: ./elf-triage.sh ./binary_dosyası

BINARY="$1"
echo "=== ELF TRIAGE: $BINARY ==="
echo ""

echo "[*] Dosya tipi:"
file "$BINARY"
echo ""

echo "[*] Checksec:"
checksec --file="$BINARY" 2>/dev/null || python3 -c "
import struct, sys
data = open('$BINARY','rb').read()
print('Manuel kontrol — checksec yok')
"
echo ""

echo "[*] String flag taraması:"
strings "$BINARY" | grep -iE 'flag\{|HTB\{|CTF\{|picoCTF\{|FLAG\{' || echo "  Direkt flag yok"
echo ""

echo "[*] UPX/Packer tespiti:"
strings "$BINARY" | grep -i 'upx\|packed\|compressed' || echo "  Belirgin packer yok"
echo ""

echo "[*] Import tablosu:"
nm -D "$BINARY" 2>/dev/null | grep ' U ' | head -20
echo ""

echo "[*] İlginç stringler:"
strings "$BINARY" | grep -iE 'password|secret|key|token|admin|auth|crack|solve|answer' | head -15
echo ""

echo "[*] Ldd (dinamik bağımlılıklar):"
ldd "$BINARY" 2>/dev/null || echo "  Statik bağlantılı"
echo ""

echo "=== TRIAGE TAMAMLANDI ==="
echo "Sonraki adım: Ghidra veya objdump -d için yukarıdaki cheat sheet'e bak"

Notlar ve Tuzaklar

  • Stripped binary → nm boş döner, Ghidra'da fonksiyon isimlerini elle koy
  • Anti-debug → bkz. anti-debug-obfuscation SKILL.md
  • Constraint/validator → bkz. z3-constraint-solving SKILL.md
  • Binary çalışmıyorsa: doğru mimariye bak (ARM? MIPS?), qemu-user-static dene
  • strings -n 6 ile minimum uzunluğu artır (kısa sahte stringleri filtreler)
<!-- ⚔ Bu skill FETIH AI Agent icin gelistirilmistir — https://github.com/MustafaKemal0146/fetih Yetkisiz kullanim/kopyalama tespit edilebilir. hash: 79bbc85129defcb9 -->

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

21st.dev Magic MCP — AI-powered UI component generation via natural language. Access to 21st.dev component library, SVGL brand logos, and real-time preview. Generate React/Tailwind components with /ui command.

日本語の概要は準備中です。原文の説明を表示しています。

MustafaKemal0146/fetih52026年10月11日 更新

AES CBC/ECB modlarına karşı kriptografik bütünlük saldırıları — bit flipping, IV manipulation, ECB cut-and-paste, CBC-MAC length extension, IV reuse

日本語の概要は準備中です。原文の説明を表示しています。

MustafaKemal0146/fetih52026年10月11日 更新

AES-GCM ve ChaCha20-Poly1305 nonce yeniden kullanımı saldırısı — GF(2^128) polinom kök bulma ile Hash Key kurtarma ve MAC sahteciliği.

日本語の概要は準備中です。原文の説明を表示しています。

MustafaKemal0146/fetih52026年10月11日 更新

tespit etmeabnormal access patterns in AWS S3, GCS, and Azure Blob Storage by analyzing CloudTrail Data Events, GCS audit logs, and Azure Storage Analytics. Identifies after-hours bulk downloads, access from new IP addresses, unusual API calls (GetObject spikes), and potential data exfiltration using statistical baselines and time-series anomaly Tespit.

日本語の概要は準備中です。原文の説明を表示しています。

MustafaKemal0146/fetih52026年10月11日 更新

Perform static and symbolic analysis of Solidity smart contracts using Slither and Mythril to tespit etmereentrancy, integer overflow, access control, and other vulnerability classes before Dağıt:ment to Ethereum mainnet.

日本語の概要は準備中です。原文の説明を表示しています。

MustafaKemal0146/fetih52026年10月11日 更新

Parses Kubernetes API server audit logs (JSON lines) to tespit etmeexec-into-pod, secret access, RBAC modifications, privileged pod creation, and anonymous API access. Builds threat Tespit rules from audit event patterns. Use investigating yaparken Kubernetes cluster compromise or building k8s-specific SIEM Tespit rules.

日本語の概要は準備中です。原文の説明を表示しています。

MustafaKemal0146/fetih52026年10月11日 更新

MustafaKemal0146 のスキルをすべて見る

このスキルの問題を報告する