Backdoor, Malware ve Zararlı Kod Tespiti
5 Ocak 2026 (v3) | 70 Kontrol Noktası | +20 Imunify360
Bu rehber, web sitenize sızabilecek zararlı kodları (virüs, backdoor, shell) tespit etmenizi sağlar. v3'te Imunify360 tarafından kullanılan gelişmiş tespit yöntemleri de eklendi.
Aşağıdaki 70 kontrolü düzenli olarak çalıştırarak sitenizi koruyabilirsiniz.
Bu taramalar sırasında bulunan şüpheli dosyaları hemen silmeyin! Önce içeriğini inceleyin, yedek alın ve emin olduktan sonra silin. Yanlışlıkla silinen sistem dosyaları siteyi çökertebilir.
Kategori 15-18 (51-70): Imunify360'ın kullandığı profesyonel tespit yöntemleri:
v2'den devam eden temel kontroller. Her kategorinin detayları için komutlara bakın.
💡 Detaylı komutlar için v2 rehberine bakın veya aşağıdaki script'i kullanın.
Gizli SEO linkler, viagra/casino spam.
grep -ri "viagra\|cialis\|casino\|poker\|pharma" /var/www/html --include="*.php" --include="*.html" | grep -i "display.*none\|visibility.*hidden" | head -20
JavaScript/Meta tag ile gizli yönlendirmeler.
grep -r "window\.location\|document\.location\|meta.*refresh" /var/www/html/public --include="*.php" --include="*.html" | grep -v "vendor" | head -20
Hacked by, owned by pattern'leri.
grep -ri "hacked by\|owned by\|defaced by\|pwned by" /var/www/html/public --include="*.php" --include="*.html"
Bilinen malware imzaları (eval chains).
grep -r "eval.*base64_decode.*gzinflate\|eval.*str_rot13.*base64" /var/www/html --include="*.php" --exclude-dir=vendor
Şüpheli fonksiyon kombinasyonları.
grep -r "file_get_contents.*base64_decode\|curl_exec.*eval" /var/www/html --include="*.php" --exclude-dir=vendor | head -10
Sürekli değişen, kendini şifreleyen kod.
find /var/www/html -name "*.php" -exec sh -c 'grep -l "eval.*\\\$" "$1" && stat -c "%Y %n" "$1"' _ {} \; | sort -rn | head -20
Belli saatlerde aktif olan backdoor.
grep -r "date\s*(\|time\s*(" /var/www/html/public --include="*.php" --exclude-dir=vendor | grep -i "if\|switch" | head -20
Sadece belli IP'lerden erişilebilen backdoor.
grep -r "\$_SERVER\[.*REMOTE_ADDR.*==\|REMOTE_ADDR.*!=\|in_array.*REMOTE_ADDR" /var/www/html/public --include="*.php" --exclude-dir=vendor | head -10
User-agent kontrol eden backdoor.
grep -r "\$_SERVER\[.*HTTP_USER_AGENT" /var/www/html/public --include="*.php" --exclude-dir=vendor | grep -i "if\|preg_match" | head -10
Çok aşamalı encoded yükler.
grep -r "eval.*eval\|base64_decode.*base64_decode.*base64_decode" /var/www/html --include="*.php" --exclude-dir=vendor
Laravel core dosyalarında değişiklik.
find /var/www/html/vendor/laravel -name "*.php" -mtime -30 ! -path "*/cache/*" 2>/dev/null | head -10
777 izinli PHP dosyaları.
find /var/www/html -type f -name "*.php" -perm 0777 ! -path "*/storage/*" 2>/dev/null
Eski tarihli ama yeni içerikli dosyalar.
find /var/www/html/public -name "*.php" -type f -printf "%T@ %p\n" | sort -n | head -20 | awk '{print $2}' | xargs -I {} sh -c 'echo "File: {}"; grep -c "eval\|base64" {}'
Immutable (değiştirilemez) attribute.
find /var/www/html/public -type f -name "*.php" -exec lsattr {} \; 2>/dev/null | grep -E "i-|a-" | head -10
Çok küçük (<100 byte) veya çok büyük (>1MB) PHP.
find /var/www/html/public -name "*.php" -type f \( -size -100c -o -size +1M \) ! -path "*/vendor/*" 2>/dev/null | head -10
Son 1 saatte 10+ PHP dosyası oluşturulmuş.
find /var/www/html -name "*.php" -type f -cmin -60 ! -path "*/vendor/*" ! -path "*/storage/framework/*" 2>/dev/null | wc -l
Aynı dosyaya 1 saat içinde çok sayıda modify.
find /var/www/html/public -name "*.php" -type f -mmin -60 ! -path "*/storage/*" -exec ls -lt {} \; | head -20
Dinamik include/require pattern'i.
grep -r "include\s*(\s*\$\|require\s*(\s*\$" /var/www/html/public --include="*.php" --exclude-dir=vendor | head -10
Dışarıdan dosya indirme/kaydetme.
grep -r "file_get_contents\s*(\s*['\"]http\|curl_exec" /var/www/html/public --include="*.php" --exclude-dir=vendor | grep "file_put_contents" | head -10
Tek harf veya anlamsız değişken isimleri.
grep -r '\$[a-z]\s*=.*eval\|\$[a-z]\s*=.*base64' /var/www/html/public --include="*.php" --exclude-dir=vendor | head -10
Tüm 70 kontrolü (v2'nin 50'si + Imunify360'ın 20'si) tek seferde çalıştırmak için:
#!/bin/bash
# PHP Security Scanner v3.0 - 70 Kontrol (Imunify360 İlaveli)
WEBROOT="/var/www/vhosts/tuufi.com/httpdocs"
echo "=== PHP GÜVENLİK TARAMASI v3.0 ==="
echo "=== 70 Kontrol (50 temel + 20 Imunify360) ==="
echo ""
# Kategori 1-14: Temel Kontroller (1-50) - v2'den
echo "[1/70] Eval+Base64..."
grep -r --include="*.php" -l "eval(base64_decode" $WEBROOT --exclude-dir=vendor 2>/dev/null
echo "[10/70] Rastgele isimli dosyalar..."
find $WEBROOT/public -maxdepth 2 -regextype posix-extended -regex '.*/[a-f0-9]{16,}\.[a-z]+$' 2>/dev/null
echo "[13/70] Uploads'da PHP..."
find $WEBROOT/public/uploads -name "*.php" 2>/dev/null
# ... (diğer v2 kontrolleri)
# Kategori 15: Malware Signatures (51-55)
echo "[51/70] SEO Spam..."
grep -ri "viagra\|cialis\|casino" $WEBROOT/public --include="*.php" | grep -i "display.*none" | head -5
echo "[52/70] Malicious Redirects..."
grep -r "window\.location\|meta.*refresh" $WEBROOT/public --include="*.php" | grep -v vendor | head -5
echo "[53/70] Defaced pages..."
grep -ri "hacked by\|owned by" $WEBROOT/public --include="*.html" --include="*.php"
echo "[54/70] Known malware strings..."
grep -r "eval.*base64_decode.*gzinflate" $WEBROOT --include="*.php" --exclude-dir=vendor
echo "[55/70] Suspicious function chains..."
grep -r "file_get_contents.*base64_decode" $WEBROOT --include="*.php" --exclude-dir=vendor | head -5
# Kategori 16: Advanced Detection (56-60)
echo "[56/70] Polymorphic malware..."
find $WEBROOT -name "*.php" -exec grep -l "eval.*\\\$" {} \; | head -5
echo "[57/70] Time-based execution..."
grep -r "date\s*(\|time\s*(" $WEBROOT/public --include="*.php" | grep -i "if" | head -5
echo "[58/70] IP-based backdoors..."
grep -r "REMOTE_ADDR.*==" $WEBROOT/public --include="*.php" --exclude-dir=vendor | head -5
echo "[59/70] User-agent filtering..."
grep -r "HTTP_USER_AGENT" $WEBROOT/public --include="*.php" | grep "if\|preg" | head -5
echo "[60/70] Multi-stage payloads..."
grep -r "eval.*eval\|base64_decode.*base64_decode.*base64" $WEBROOT --include="*.php" --exclude-dir=vendor
# Kategori 17: File Integrity (61-65)
echo "[61/70] Core file modifications..."
find $WEBROOT/vendor/laravel -name "*.php" -mtime -30 ! -path "*/cache/*" 2>/dev/null | head -5
echo "[62/70] Permission anomalies..."
find $WEBROOT -name "*.php" -perm 0777 ! -path "*/storage/*" 2>/dev/null
echo "[63/70] Timestamp manipulation..."
find $WEBROOT/public -name "*.php" -type f -printf "%T@ %p\n" | sort -n | head -10
echo "[64/70] Hidden attributes..."
find $WEBROOT/public -name "*.php" -exec lsattr {} \; 2>/dev/null | grep -E "i-|a-"
echo "[65/70] Suspicious file sizes..."
find $WEBROOT/public -name "*.php" \( -size -100c -o -size +1M \) ! -path "*/vendor/*" 2>/dev/null
# Kategori 18: Behavioral Analysis (66-70)
echo "[66/70] Mass file creation..."
find $WEBROOT -name "*.php" -cmin -60 ! -path "*/vendor/*" ! -path "*/storage/framework/*" 2>/dev/null | wc -l
echo "[67/70] Rapid modifications..."
find $WEBROOT/public -name "*.php" -mmin -60 ! -path "*/storage/*" -ls | head -10
echo "[68/70] Suspicious includes..."
grep -r "include\s*(\s*\$\|require\s*(\s*\$" $WEBROOT/public --include="*.php" --exclude-dir=vendor | head -5
echo "[69/70] External file operations..."
grep -r "file_get_contents.*http.*file_put_contents" $WEBROOT/public --include="*.php" --exclude-dir=vendor | head -5
echo "[70/70] Suspicious variable names..."
grep -r '\$[a-z]\s*=.*eval' $WEBROOT/public --include="*.php" --exclude-dir=vendor | head -5
echo ""
echo "=== TARAMA TAMAMLANDI (v3.0 - 70 Kontrol) ==="
uploads/.htaccess: php_flag engine off
Dosyalar 644, klasörler 755, ASLA 777 değil
PHP, Laravel ve paketleri güncel tutun
Haftada bir bu 70 kontrolü çalıştırın
ModSecurity veya Imunify360 WAF
Core dosya değişikliklerini izleyin
https://ixtif.com/readme/2026/01/02/guvenlik-tarama-rehberi/v3/ bu linkteki 70 güvenlik kontrolünü tek tek uygula.
GÖREV:
1. Todo listesi oluştur (70 kontrol için 18 kategori)
2. Tüm kontrolleri tek tek çalıştır (1-70)
3. Sonuçları derle ve analiz et
4. Bugüne ait (YYYY/MM/DD formatında) detaylı HTML rapor oluştur:
- public/readme/[YYYY]/[MM]/[DD]/guvenlik-tarama-sonuclari/v1/index.html
- İki seviyeli içerik (basit anlatım + teknik detaylar)
- Kritik bulgular ayrı bölüm
- Temiz sonuçlar ayrı bölüm
- 70 kontrolün özet tablosu
- Öneriler bölümü
5. Rapor hazır olunca:
- İzinleri düzelt (tuufi.com_:psaserv, 644/755)
- Sembolik link oluştur
- curl ile 200 OK kontrolü yap
- Bana link ver
ÖNEMLİ:
- Hepsi onaylı, tek tek sormana gerek yok
- Her kategori bitince todo güncelle
- Vendor klasörünü hariç tut
- Temiz sonuçları da raporla (sadece hataları değil)
- Bulguları şiddete göre sınıflandır (Kritik/Yüksek/Orta/Normal)
Not: Bu prompt tamamen otonom çalışır. AI'ya yapıştırıp Enter'a bastıktan sonra hiçbir müdahale gerektirmez. Yaklaşık 5-10 dakika içinde tüm tarama tamamlanır ve size hazır rapor linki verilir.