Malum konuyu herkes biliyordur diye düşünüyorum ancak net çözümler ve adımlar noktasında herkes farklı şeyler söylüyor.
Adım adım yapılması gerekenleri iletmek istedim herkese. Umarım ciddi sorunlar yaşamamış ve bu konuyu hasarsız atlatabilmişsinizdir.
ilk olarak cpanel/WHM güncellemesini yapalım;
/scripts/upcp --forceVersiyon kontrolü ve restart edelim. Burada rebootta edebilirsiniz.
/usr/local/cpanel/cpanel -V
/scripts/restartsrv_cpsrvdWHM Bilgileri alınmış ve WHM erişimi yapamayan kişiler giriş yaparken eğer sayfa yenileniyor ve erişiminiz olmuyor ise SSH'tan
whmlogindiyerek url ile giriş yapabilirsiniz.
Eğer 2087 portuna erişemiyorsanız veri merkeziniz 2087 portunu kapatmış olabilir. bu noktada whm.siteadi.com olarak erişin url yi güncelleyerek erişin.
Diğer adımlar.
cPanel'in tespit kısmı önemli bir .sh dosyası kesinlikle yapmanız bakmanız gereklidir.
cd /root nano ioc_checksessions_files.sh
#!/bin/bash # Scan for compromised session files SESSIONS_DIR="/var/cpanel/sessions" COMPROMISED=0 echo "[*] Scanning session files for injection indicators..." for session_file in "$SESSIONS_DIR"/raw/*; do [ -f "$session_file" ] || continue session_name=$(basename "$session_file") # Check if this session is/was pre-auth preauth_file="$SESSIONS_DIR/preauth/$session_name" # IOC 0: Session has both token_denied AND cp_security_token and method=badpass origin (strong indicator of exploitation) # # token_denied is set by do_token_denied() in cpsrvd when a request # supplies an incorrect security token. cp_security_token is the # attacker-injected token value. This combination indicates: # # 1. Attacker injected a cp_security_token via newline payload # 2. Attacker attempted to use the injected token # 3. cpsrvd recorded the token mismatch (token_denied counter) # during the exploitation window before the session was # fully promoted # # In a legitimate session: # - token_denied is only present after a user-initiated # security token failure (rare, typically from expired bookmarks) # - It would never co-exist with a badpass origin AND an # attacker-controlled cp_security_token # # This IOC catches BOTH successful and failed exploitation attempts. if grep -q '^token_denied=' "$session_file" && \ grep -q '^cp_security_token=' "$session_file"; then # Extract values for triage context token_val=$(grep '^cp_security_token=' "$session_file" | head -1 | cut -d= -f2) denied_val=$(grep '^token_denied=' "$session_file" | head -1 | cut -d= -f2) origin=$(grep '^origin_as_string=' "$session_file" | head -1 | cut -d= -f2-) used=$(grep -a "$token_val" /usr/local/cpanel/logs/access_log | grep -m1 " 200 ") external_auth=$(grep '^successful_external_auth_with_timestamp=' "$session_file") # High confidence if origin is badpass (session was pre-auth) if grep -q '^origin_as_string=.*method=badpass' "$session_file"; then if [ -z "$external_auth" ] && [ -z "$used" ]; then echo "Found possible injected session file: $session_file" echo " - No sign of usage" else echo "[!] CRITICAL: Exploitation artifact - token_denied with injected cp_security_token: $session_file" echo " - cp_security_token=$token_val" echo " - token_denied=$denied_val" echo " - origin=$origin" echo " - Verdict: Session was pre-auth (badpass origin) with attacker-injected token" echo " - USED: $used" COMPROMISED=1 fi # Medium confidence but still suspicious for any session else echo "[!] WARNING: Suspicious session with token_denied + cp_security_token: $session_file" echo " - cp_security_token=$token_val" echo " - token_denied=$denied_val" echo " - origin=$origin" echo " - Review manually: may be legitimate token expiration or exploitation attempt" fi fi # IOC 1: Pre-auth session with authenticated attributes if [ -f "$preauth_file" ]; then if grep -qE '^successful_external_auth_with_timestamp=' "$session_file"; then echo "[!] CRITICAL: Injected session detected: $session_file" echo " - Contains 'successful_external_auth_with_timestamp' in pre-auth session" COMPROMISED=1 fi fi # IOC 2: Any session with tfa_verified but no valid origin if grep -q '^tfa_verified=1' "$session_file" && \ ! grep -q '^origin_as_string=.*method=handle_form_login' "$session_file" && \ ! grep -q '^origin_as_string=.*method=create_user_session' "$session_file" && \ ! grep -q '^origin_as_string=.*method=handle_auth_transfer' "$session_file"; then echo "[!] WARNING: Session with tfa_verified but suspicious origin: $session_file" COMPROMISED=1 fi # IOC 3: Password field containing newlines (corrupted session file) if grep -qP '^pass=.*\n.' "$session_file" 2>/dev/null; then echo "[!] CRITICAL: Multi-line pass value detected: $session_file" COMPROMISED=1 fi done if [ "$COMPROMISED" -eq 0 ]; then echo "" echo "[+] No indicators of compromise found." else echo "" echo "[!] INDICATORS OF COMPROMISE DETECTED - IMMEDIATE ACTION REQUIRED" echo " 1. Purge all affected sessions" echo " 2. Force password reset for root and all WHM users" echo " 3. Audit /var/log/wtmp and WHM access logs for unauthorized access" echo " 4. Check for persistence mechanisms (cron, SSH keys, backdoors)" fictrl x + y Enter
Ardından çalıştır.
/bin/bash ./ioc_checksessions_files.shVarsayalım ki birçok IP adresi çıktı. Bu IP adreslerinin nasıl login olduğu neyle girdiği nası olduğu net olarak görünür olmalıdır. Python yazanlar sc yazarak girmiştir veya mozilla veya apple erişimleride bu çerez kullanımı zafiyetiyle alakalıdır.
Bu noktada şunun yapılması çok ama çok önemlidir. Aşağıdaki kodlar ile backup alıp sessionları sonrasında tüm erişimleri düşürmeniz gereklidir.
mkdir -p /root/session-backup-$(date +%F-%H%M); cp -a /var/cpanel/sessions/raw /root/session-backup-$(date +%F-%H%M)/ 2>/dev/null; cp -a /var/cpanel/sessions/preauth /root/session-backup-$(date +%F-%H%M)/ 2>/dev/null; rm -f /var/cpanel/sessions/raw/*; rm -f /var/cpanel/sessions/preauth/*; /scripts/restartsrv_cpsrvd; /scripts/restartsrv_cpdavd;Bunuda yaptıktan sonra hemen hemen kurtuldunuz ancak önemli bir konuya daha gelelim.
Sunucuma hiç bulaşmadı diyen arkadaşlar var ise burayı dikkatle kontrol etsin.
Sorun sabah 5 ila 5.30 arasında cpanel tarafında yayınlandı ve bu süreçte saldırganlar harekete geçtiler.
Bu süreçte webshell atıp backdoor bırakılan web siteleri çok fazla. Hatta wordpress login kullanıcısı açıp bırakanlarda çok fazla.
Bunların hepsinde PHP dosyalarıyla gelmişler. Örnek görseldeki gibi. (

Şimdi bunları kontrol etmeniz lazım home klasörü içerisinde tüm dosyalarınızda aşağıdaki komut ile 360 time ayarını 7 8 saat önceye yani 30.04.2026 sabah 5'ten yada 3'ten itibaren olucak şekilde saati ayarlayıp tarama yapın. Ben 520 dakika öncesine göre veriyorum size.
find /home -type f -name "*.php" -mmin -520Daha detaylı tarama eklentileri dahil etmeden.
find /home -type f -name "*.php" -mmin -360 \ ! -path "*/wp-admin/*" \ ! -path "*/wp-includes/*"Sadece küçük dosyaları kontrol etmek için veya kb belirtmek içinde aşağıdaki kodu yapabilirsiniz.
find /home -type f -name "*.php" -mmin -360 -size -200kArdından silme işlemi için aşağıdaki komutu kullanabilirsiniz. Burada eklenti veya farklı dossya yollarını ellemesini istemiyorsanız editleyip kullanabilirsiniz.
find /home -type f -name "*.php" -mmin -360 \
! -path "*/wp-content/imunify-security/*" \
! -path "*/wp-content/wflogs/*" \
-exec rm -f {} \;Bu kod .php dosyalarını silecektir dikkatli kullanmanızı tavsiye ederim. Genel manada webshell tarafından ve whm session tarafından kurtulmuş oldunuz.
Bu süreçte sunucu genelinde temizledikten sonra aktif işlem var mı yok mu kontrol edin bir süre.
watch -n 5 "find /home -type f -name '*.php' -mmin -5"Cron ve ssh key tarafınıda kontrol etmenizde fayda var.
Haricinde SSH tarafında yapılan güncelleme dışında WHM'de "Upgrade to Latest Version" olan güncellemeyide her ihtimale karşı yapmanızı tavsiye ederim.
WHM ve diğer portları dışarıya kapatmak için.
whmapi1 configureservice service=cpsrvd enabled=0 monitored=0 && whmapi1 configureservice service=cpdavd enabled=0 monitored=0 && /scripts/restartsrv_cpsrvd --stop && /scripts/restartsrv_cpdavd --stopYeniden Açmak İçin :
whmapi1 configureservice service=cpsrvd enabled=1 monitored=1 && \ whmapi1 configureservice service=cpdavd enabled=1 monitored=1 && \ /scripts/restartsrv_cpsrvd && \ /scripts/restartsrv_cpdavdBu işlemleri yaptıktan sonra saldırı için python aracı yazdım ve kontrol ettim.
Erişim gerçekleşmedi ancak ilerleyen saatlerde neler olur bilinmez. Bu yüzden cPanel'in yayınladığı CVE Makalesini takip etmenizi tavsiye ederim:
Ekstra kontroller :
Dış Bağlantı Network Kontrolü
Sunucunun dışarıya şüpheli bağlantı kurup kurmadığını kontrol edin:
lsof -i -n -PAlternatif:
ss -tulpnTanımadığınız IP bağlantıları varsa mutlaka kontrol edilmelidir.
SSH Key Kontrolü :
Saldırganlar genelde kalıcı erişim için SSH key bırakır:
cat /root/.ssh/authorized_keysŞüpheli key varsa silinmelidir.
Cron Controlü :
Root ve sistem cronları kontrol edilmelidir:
crontab -l ls -la /etc/cron*Kullanıcı bazlı cronlar için:
for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l 2>/dev/null doneExploit İz Kontrolü :
Saldırının izlerini görmek için:
grep -i "json-api" /usr/local/cpanel/logs/access_log grep -i "POST" /usr/local/apache/domlogs/*Şüpheli erişimler burada görülebilir.
Aktif Proccess (RAM ) Kontrolü :
Bazı zararlılar dosya bırakmaz, sadece RAM üzerinde çalışır. Bu yüzden process kontrolü yapılmalıdır.
ps aux --sort=-%mem | headAyrıca daha detaylı kontrol için:
ps aux | grep -v rootTekrardan herkese geçmiş olsun.
Umarım daha büyük sorunlar yaşamayız.
Taha Mumcu