Encoding vs Crypto
encoding difficulty: kolay
Encoding veri temsilini değiştirir; gizlilik sağlamaz. Crypto (şifreleme / MAC / imza) anahtar olmadan okunabilirliği veya sahteciliği engellemeyi amaçlar. CTF ve pentestte en sık hata: base64’ü “şifre” sanmak.
Ön koşullar
Section titled “Ön koşullar”- Şüpheli blob (cookie, hidden field, lisans, API alan)- CyberChef / python / xxd- Payload Encoder aracı: /tools/payload-encoder/Hızlı ayrım
Section titled “Hızlı ayrım”| Encoding | Crypto | |
|---|---|---|
| Amaç | Taşıma / temsil | Gizlilik veya bütünlük |
| Anahtar | Yok | Var (veya asimetrik çift) |
| Örnek | base64, hex, URL-encode | AES-GCM, ChaCha20-Poly1305, RSA-OAEP |
| “Kırma” | Decode | Anahtar / oracle / uygulama hatası |
-
Alfabe bak —
A-Za-z0-9+/=→ base64 adayı; sadece0-9a-f→ hex. -
Decode et — anlamlı JSON/XML/path çıkıyor mu?
-
Katman soy — base64(hex(json)) gibi çift encoding sık.
-
Hâlâ rastgele entropi yüksekse — gerçek cipher veya sıkıştırma+encrypt.
-
Uygulama — “encrypt()” adı yanıltıcı olabilir; kaynak/jadx’te doğrula.
Base64 / hex pratik
Section titled “Base64 / hex pratik”echo 'eyJ1c2VyIjoiYWRtaW4ifQ==' | base64 -decho '7b2275736572223a2261646d696e227d' | xxd -r -ppython3 -c "import base64print(base64.b64decode('cGFzc3dvcmQ='))"# URL-safe base64 (JWT)python3 -c "import base64; print(base64.urlsafe_b64decode('eyJhbGciOiJub25lIn0=' + '=='))"JWT parçaları encoding’dir; güvenlik imzadadır — bkz. JWT Saldırıları.
Sık CTF / pentest hataları
Section titled “Sık CTF / pentest hataları”1. “Encrypted cookie” = base64(json) → claim değiştir, tekrar encode2. Çift base64 veya base64 + ROT13 → CyberChef Magic3. Hex string’i ASCII sanmak (veya tersi)4. Hash (SHA-256) ile encryption karıştırmak — hash geri döndürülemez5. Homegrown XOR + base64 → “crypto”; anahtar kısa/sabitse trivial6. Client-side “secret” (JS’te key) → attacker key’e sahipXOR laboratuvarı (sabit tek bayt — eğitim):
python3 -c "d=bytes.fromhex('1a1b1c'); print(bytes(b^0x42 for b in d))"Entropi ipucu
Section titled “Entropi ipucu”Düşük / yapısal → encoding veya zayıf obfuscationYüksek + sabit uzunluk → cipher veya hashBlok tekrarı → ECB şüphesi (bkz. classical-attacks)# kaba entropi hissi: sıkışma oranıwc -c < blob.bingzip -c blob.bin | wc -cİyi sıkışıyorsa büyük ihtimalle encoding/plaintext; az sıkışıyorsa şifreli veya zaten sıkıştırılmış.
base64 · decode
embedded toolecho 'eyJyb2xlIjoiYWRtaW4ifQ==' | base64 -dPadding (=) eksikse python urlsafe_b64decode dene. Binary çıktıda | xxd kullan. Satır sonu için çıktıya ; echo ekleyebilirsin.
base64 · decode
Section titled “base64 · decode”echo 'eyJyb2xlIjoiYWRtaW4ifQ==' | base64 -dZincir
Section titled “Zincir”Hidden field “e=” → base64 → {"role":"user"} → role=admin → encode → yetki yükseltmeLisans anahtarı → hex → XOR 0x37 → plaintext flag