Backdoor, Malware ve Zararlı Kod Tespiti + Güvenli Silme
v2 + v3 + v4 + Yeni Kontroller = v5
5 Ocak 2026 (v5 - Final) | 90 Kontrol Noktası | 50 Temel + 20 Imunify360 + 20 Yeni
Bu rehber, web sitenize sızabilecek zararlı kodları tespit eder ve güvenli silme talimatları verir. v5 en kapsamlı sürümdür: 90 kontrol + otomatik silme prosedürü.
Aşağıdaki 90 kontrolü çalıştırın, bulgular için güvenli silme prosedürü uygulayın.
❌ ASLA: Bulunan dosyaları hemen silmeyin!
✅ YAPILACAKLAR (DOĞRU SIRA):
git add -A && git commit -m "🔧 CHECKPOINT: Before cleanup"git push origin maincp dosya.php dosya.php.backupcat dosya.phpsudo rm dosya.php veya düzenlecurl -I https://site.com/ → 200 OK?git reset --hard [checkpoint-hash]git add -A && git commit -m "Security: Cleaned malware" && git push origin mainKRİTİK: Checkpoint'i remote'a push etmeden silme yapma! Local disk sorununda checkpoint da kaybolur.
Git Checkpoint, zararlı dosyaları silmeden önce sistemin anlık fotoğrafını çekmek gibidir. Eğer temizleme sırasında yanlışlıkla önemli bir dosya silerseniz, tek tuşla geri dönebilirsiniz.
Örnek: 100 dosya sildiniz, site bozuldu → Checkpoint'e dönüp sadece 5 dakika önceki halinize geri dönebilirsiniz!
Git checkpoint, git commit komutu ile oluşturulur.
Bu, tüm dosya değişikliklerini SHA hash ile kaydeder ve istediğiniz zaman
git reset ile geri dönmenizi sağlar.
1. Mevcut durumu kaydet:
git add -A
2. Checkpoint oluştur:
git commit -m "🔧 CHECKPOINT: Before security cleanup"
3. Checkpoint hash'ini kaydet:
git log -1 --oneline
Çıktı örneği: abc123f 🔧 CHECKPOINT: Before security cleanup
abc123f hash'ini not edin!
4. Remote'a push et (ZORUNLU!):
git push origin main
⚠️ KRİTİK: Push etmeden silme yapma! Remote'da güvenli kopya olmalı.
❌ Durum: Yanlış dosya sildim, site bozuldu, geri dönmek istiyorum!
1. Checkpoint hash'ini bul:
git log --oneline -10
Son 10 commit'i gösterir. "CHECKPOINT" yazan satırdaki hash'i kopyala.
2. Geri dön (HARD RESET):
git reset --hard abc123f
⚠️ DİKKAT: Bu komut checkpoint'ten sonraki TÜM DEĞİŞİKLİKLERİ SİLER!
Silinen dosyalar geri gelir, değiştirilen dosyalar eski haline döner.
3. Dosyaları kontrol et:
ls -la
Sildiğiniz dosyalar geri gelmiş olmalı.
"CHECKPOINT: 2026-01-05 14:30"git push origin mainSenaryo: 90 kontrol sonucu 15 zararlı dosya bulundu
# 1. Checkpoint oluştur
git add -A && git commit -m "🔧 CHECKPOINT: Before cleanup (15 files)"
git log -1 --oneline # Hash: abc123f
# 2. Remote'a push et (ZORUNLU!)
git push origin main
⚠️ Bu adım ZORUNLU! Remote'da güvenli kopya olmalı.
# 3. Zararlı dosyaları sil
sudo rm public/shell.php vendor/autoload.suspected ...
# 4. Site test et
curl -I https://site.com/ # 200 OK?
# 5a. SORUN VARSA → Geri dön!
git reset --hard abc123f
git push origin main --force # Remote'u da geri al
# 5b. SORUN YOKSA → Kaydet ve push
git add -A && git commit -m "Security: Cleaned 15 malware files"
git push origin main
Backdoor, encoding, network, sistem, Imunify360 testleri.
Info disclosure, credential exposure, attack patterns, config issues.
Otomatik yedek, analiz, temizleme prosedürü.
Hazır prompt: tek tıkla 90 kontrol + rapor.
En yaygın backdoor pattern'i. Şifreli kod çalıştırır.
grep -r --include="*.php" -l "eval(base64_decode" /var/www/html --exclude-dir=vendor
Sistem komutları çalıştıran fonksiyonlar.
grep -r --include="*.php" -l "passthru\|shell_exec\|system\s*(" /var/www/html/public --exclude-dir=vendor
Kullanıcı girdisini doğrudan çalıştıran kod.
grep -r --include="*.php" -l '\$_\(REQUEST\|POST\|GET\).*eval\|eval.*\$_\(REQUEST\|POST\|GET\)' /var/www/html
PHP assert() fonksiyonu kod çalıştırabilir.
grep -r --include="*.php" "assert\s*(" /var/www/html/public --exclude-dir=vendor
Eski PHP exploit yöntemi.
grep -r --include="*.php" -l "create_function" /var/www/html --exclude-dir=vendor
Şifreli içeriği dosyaya yazan kod.
grep -r --include="*.php" -l "file_put_contents.*base64_decode" /var/www/html --exclude-dir=vendor
Dosya kopyalama/taşıma (hata gizleme ile).
grep -r --include="*.php" -l "@copy\|@rename\|@move" /var/www/html/public --exclude-dir=vendor
İzin değiştirme komutları.
grep -r --include="*.php" -l "chmod\|chown" /var/www/html/public --exclude-dir=vendor
Nokta ile başlayan gizli PHP dosyaları.
find /var/www/html -name ".*php" -o -name ".*.php" 2>/dev/null
453bbb9eb16f.php gibi rastgele isimler.
find /var/www/html/public -maxdepth 2 -type f -regextype posix-extended -regex '.*/[a-f0-9]{16,}\.[a-z]+$'
Public klasöründe olmaması gereken PHP'ler.
find /var/www/html/public -maxdepth 1 -name "*.php" ! -name "index.php" ! -name "robots.txt"
Marker/beacon dosyaları.
find /var/www/html/public -maxdepth 1 -name "*.txt" ! -name "robots.txt"
Upload klasöründe PHP dosyası OLMAMALI!
find /var/www/html/public/uploads -name "*.php" 2>/dev/null
phtml, phar, php5, php7 uzantıları.
find /var/www/html/public/uploads -type f \( -name "*.phtml" -o -name "*.phar" -o -name "*.php5" -o -name "*.php7" \)
JPG/PNG/GIF içine gizlenmiş PHP kodu.
find /var/www/html -type f \( -name "*.jpg" -o -name "*.png" -o -name "*.gif" \) -exec grep -l "<?php" {} \;
Sıkıştırılmış zararlı kod.
grep -r --include="*.php" -l "gzinflate\|gzuncompress\|str_rot13" /var/www/html/public
chr(98).chr(97)... formatı.
grep -r --include="*.php" -l "chr(98).chr(97).chr(115).chr(101)" /var/www/html
50+ karakter base64 encoded string.
grep -r --include="*.php" -l '\$[a-zA-Z_]*\s*=\s*["'"'"'][a-zA-Z0-9+/=]\{50,\}["'"'"']' /var/www/html/public
Eski PHP versiyonlarında kod çalıştırır.
grep -r --include="*.php" "preg_replace.*['\"]\/.*e['\"]" /var/www/html --exclude-dir=vendor
Uzak bağlantı açan kod.
grep -r --include="*.php" -l "fsockopen\|socket_create\|pfsockopen" /var/www/html --exclude-dir=vendor
Uzak sunucudan dosya include.
grep -r --include="*.php" -l "include.*http\|require.*http" /var/www/html/public
Process açma fonksiyonu.
grep -r --include="*.php" -l "proc_open" /var/www/html/public
Zamanlanmış görevlerde backdoor.
crontab -l | grep -v "^#"
Son 7 günde değişen htaccess.
find /var/www/html -name ".htaccess" -mtime -7 -exec ls -la {} \;
Herkesin yazabildiği dosyalar.
find /var/www/html/public -type f -perm -002 ! -path "*/storage/*"
Şüpheli sembolik linkler.
find /var/www/html/public -type l ! -path "*/storage/*" ! -path "*/readme/*"
Son 24 saatte oluşturulan PHP dosyaları.
find /var/www/html -name "*.php" -mtime -1 ! -path "*/vendor/*" ! -path "*/storage/framework/*"
Son 7 günde uploads'a eklenen PHP.
find /var/www/html/public/uploads -name "*.php" -mtime -7
Kripto madenci zararlıları.
grep -r --include="*.php" -l "coinhive\|cryptonight\|stratum\|xmrig" /var/www/html
Public'te mail fonksiyonu (spam için kullanılabilir).
grep -r --include="*.php" -l "mail\s*(" /var/www/html/public --exclude-dir=vendor
$func() şeklinde dinamik fonksiyon çağrısı. Backdoor'larda çok yaygın.
grep -r --include="*.php" -l '\$[a-zA-Z_][a-zA-Z0-9_]*\s*(' /var/www/html/public --exclude-dir=vendor | head -20
call_user_func ile dinamik kod çalıştırma.
grep -r --include="*.php" -l "call_user_func\|call_user_func_array" /var/www/html/public --exclude-dir=vendor
array_map, array_filter ile kod çalıştırma.
grep -r --include="*.php" "array_map\|array_filter\|array_walk\|usort" /var/www/html/public --exclude-dir=vendor | grep -i "eval\|assert\|base64"
Reflection API ile kod çalıştırma.
grep -r --include="*.php" -l "ReflectionFunction\|ReflectionMethod" /var/www/html/public --exclude-dir=vendor
\x62\x61\x73\x65 formatında gizli kod.
grep -r --include="*.php" '\\x[0-9a-fA-F]\{2\}\\x[0-9a-fA-F]\{2\}' /var/www/html/public --exclude-dir=vendor
\142\141\163\145 formatında octal encoding.
grep -r --include="*.php" '\\[0-7]\{3\}\\[0-7]\{3\}' /var/www/html/public --exclude-dir=vendor
Çift base64 encoding ile gizleme.
grep -r --include="*.php" "base64_decode.*base64_decode" /var/www/html --exclude-dir=vendor
Binary veri manipülasyonu ile kod gizleme.
grep -r --include="*.php" "pack\s*(\|unpack\s*(" /var/www/html/public --exclude-dir=vendor
Raw POST verisi ile kod çalıştırma.
grep -r --include="*.php" "php://input" /var/www/html/public --exclude-dir=vendor
Data URI ile kod injection.
grep -r --include="*.php" "data://" /var/www/html/public --exclude-dir=vendor
Filter wrapper ile dosya okuma/encoding.
grep -r --include="*.php" "php://filter" /var/www/html --exclude-dir=vendor
Sistem komutu çalıştırma wrapper'ı.
grep -r --include="*.php" "expect://" /var/www/html --exclude-dir=vendor
c99, r57, b374k gibi ünlü shell'ler.
grep -r --include="*.php" -l "c99shell\|r57shell\|b374k\|WSO\|FilesMan" /var/www/html
Dosya yöneticisi shell imzaları.
grep -r --include="*.php" "FilesMan\|filemanager\|File Manager" /var/www/html/public --exclude-dir=vendor
Cookie ile gizli erişim kontrolü.
grep -r --include="*.php" '\$_COOKIE.*==\|md5.*\$_COOKIE' /var/www/html/public --exclude-dir=vendor
unserialize ile RCE saldırısı.
grep -r --include="*.php" "unserialize\s*(\s*\$_" /var/www/html --exclude-dir=vendor
PHP ayarlarını override eden .user.ini dosyaları.
find /var/www/html -name ".user.ini" -exec cat {} \;
Her PHP çalışmadan önce otomatik include.
grep -r "auto_prepend_file\|auto_append_file" /var/www/html -l 2>/dev/null
SVG ve XML dosyalarına gizlenmiş PHP.
find /var/www/html -type f \( -name "*.svg" -o -name "*.xml" \) -exec grep -l "<?php\|<script" {} \;
.pht, .phps, .inc gibi az bilinen PHP uzantıları.
find /var/www/html -type f \( -name "*.pht" -o -name "*.phps" -o -name "*.inc" -o -name "*.php3" -o -name "*.php4" \)
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
Public'te .env dosyası (database credential sızıntısı).
find /var/www/html/public -name ".env" -o -name ".env.backup" -o -name ".env.old" 2>/dev/null
Public'te .git klasörü (tüm kaynak kod sızıntısı).
find /var/www/html/public -type d -name ".git" 2>/dev/null
.bak, .old, .backup, ~, .swp uzantılı dosyalar.
find /var/www/html/public -type f \( -name "*.bak" -o -name "*.old" -o -name "*.backup" -o -name "*~" -o -name "*.swp" \) 2>/dev/null
Public'te .sql dosyaları (database dump sızıntısı).
find /var/www/html/public -name "*.sql" -o -name "*.sql.gz" -o -name "dump.sql" 2>/dev/null
Sistem bilgisi ifşa eden phpinfo() sayfaları.
grep -r --include="*.php" "phpinfo\s*(" /var/www/html/public --exclude-dir=vendor | head -10
Kod içine yazılmış API anahtarları.
grep -r --include="*.php" -E "api[_-]?key|apikey|api[_-]?secret" /var/www/html --exclude-dir=vendor | grep -i "=" | head -20
Public'te private key dosyaları.
find /var/www/html/public -name "id_rsa" -o -name "*.pem" -o -name "*.key" -o -name "*.ppk" 2>/dev/null
Kod içinde DB şifresi.
grep -r --include="*.php" -E "DB_PASSWORD|mysql.*password|mysqli.*connect" /var/www/html/public --exclude-dir=vendor | grep -v "env(" | head -10
Public'te composer kimlik dosyası.
find /var/www/html/public -name "auth.json" -o -name "composer.json" -o -name "composer.lock" 2>/dev/null
AWS access key, secret key hardcoded.
grep -r --include="*.php" -E "AKIA[0-9A-Z]{16}|aws_access_key|aws_secret" /var/www/html --exclude-dir=vendor | head -10
SQL injection pattern'leri (UNION, OR 1=1).
grep -r --include="*.php" -E "UNION.*SELECT|OR.*1.*=.*1|admin'--|\' OR \'1" /var/www/html/public --exclude-dir=vendor | head -10
Cross-Site Scripting saldırı izleri.
grep -r --include="*.php" --include="*.html" -E "<script>|javascript:|onerror=|onload=" /var/www/html/public --exclude-dir=vendor | grep -v "vendor\|node_modules" | head -10
../../../ pattern'i ile dosya okuma.
grep -r --include="*.php" "\.\./\.\./\.\." /var/www/html/public --exclude-dir=vendor | head -10
%00 (null byte) ile dosya uzantısı bypass.
grep -r --include="*.php" "%00\|\\x00\|chr(0)" /var/www/html/public --exclude-dir=vendor | head -10
LDAP sorgularında injection.
grep -r --include="*.php" "ldap_search\|ldap_bind" /var/www/html --exclude-dir=vendor | grep "\$_" | head -10
APP_DEBUG=true production'da (stack trace sızıntısı).
grep -r "APP_DEBUG.*true\|debug.*true" /var/www/html/.env /var/www/html/config/app.php 2>/dev/null
display_errors = On (hata mesajları gösteriliyor).
grep -r "display_errors\s*=\s*On\|error_reporting.*E_ALL" /var/www/html --include="*.ini" --include="*.php" 2>/dev/null | head -5
admin/admin, root/root gibi default şifreler.
grep -r --include="*.php" -E "password.*=.*(admin|123456|password|root)" /var/www/html/public --exclude-dir=vendor | head -10
session.cookie_secure = false (HTTP üzerinden çerez).
grep -r "session\.cookie_secure.*false\|session\.cookie_httponly.*false" /var/www/html --include="*.ini" --include="*.php" 2>/dev/null
Access-Control-Allow-Origin: * (tüm domainlere izin).
grep -r --include="*.php" "Access-Control-Allow-Origin.*\*" /var/www/html --exclude-dir=vendor | head -10
Bulguları hemen silmeyin! Önce analiz edin, yedekleyin, sonra temizleyin. Sistemi bozabilecek dosyaları asla silmeyin (vendor, core files).
Dosya meşru ama içinde zararlı kod var (örn: Laravel controller'da backdoor).
cp dosya.php dosya.php.backup-$(date +%s)
cat dosya.php | less
grep -n "eval\|base64_decode" dosya.php
nano dosya.php # Manuel temizle
php artisan route:list # Site çalışıyor mu?
git add dosya.php && git commit -m "Security: Cleaned backdoor"
Dosya %100 zararlı (örn: public/453bbb9eb16f.php webshell).
cp dosya.php /tmp/malware-backup-$(date +%s).php
cat dosya.php > /tmp/malware-analysis.txt
rm -f dosya.php
curl -I https://site.com/ # 200 OK?
git add -A && git commit -m "Security: Removed malware"
cat /tmp/malware-analysis.txt # Nasıl sızdı?
⚠️ Bu dosyalarda zararlı kod bulursan → Rapor et, sistemi yeniden kur!
https://ixtif.com/readme/2026/01/02/guvenlik-tarama-rehberi/v5/ bu linkteki 90 güvenlik kontrolünü tek tek uygula.
GÖREV:
1. Todo listesi oluştur (90 kontrol için 22 kategori)
2. Tüm kontrolleri tek tek çalıştır (1-90)
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
- 90 kontrolün özet tablosu
- GÜVENLİ SİLME PLANI bölümü (ÇOK ÖNEMLİ!)
5. Bulgu varsa GÜVENLİ SİLME prosedürü uygula:
a) YEDEK AL:
- Her dosya için timestamp'li yedek oluştur
- cp dosya.php dosya.php.backup-$(date +%s)
b) ANALİZ ET:
- Dosya tamamen zararlı mı? → SİL
- Dosya içinde zararlı kod var mı? → SADECE O KISMI TEMİZLE
- Sistem dosyası mı? (vendor, core) → ASLA SİLME, RAPOR ET
c) TEMİZLE:
- Tamamen zararlıysa: rm -f dosya
- Kısmi zararlıysa: Sadece zararlı satırları kaldır
d) TEST ET:
- Site çalışıyor mu kontrol et
- Curl ile 200 OK al
e) GIT'E KAYDET:
- git add -A
- git commit -m "Security: Cleaned malware [dosya listesi]"
6. 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)
- ⚠️ KRİTİK: Sistem dosyalarını (vendor, core) ASLA silme!
- ⚠️ KRİTİK: Silmeden önce MUTLAKA yedek al!
- ⚠️ KRİTİK: Raporda hangi dosyaların silindiğini/temizlendiğini belirt!
v5 Farkı: Bu prompt sadece tarama yapmaz, aynı zamanda bulguları güvenli şekilde temizler. Sistem dosyalarına dokunmaz, her şeyi yedekler, detaylı silme raporu oluşturur.
FTP, SSH, Database, Admin panel şifrelerini değiştir
APP_KEY, DB_PASSWORD, API anahtarlarını değiştir
uploads/.htaccess: php_flag engine off
ModSecurity, Imunify360 veya Cloudflare WAF
PHP, Laravel, tüm paketleri güncel tut
Haftada bir bu 90 kontrolü çalıştır