# NukeViet CMS: Remote Code Execution via image-upload bypass chain (PHP short-tag detection bypass + double-extension filename)

NukeViet upload pipeline accepted a GIF/PHP polyglot named shell.php.jpg, bypassing short-tag scanning and .htaccess rules, yielding RCE under Apache mod_php.

- Payout: Research
- Severity: high
- Program: NukeViet
- Found by: canhieu
- Disclosed: 2026-11-30
- CVE: CVE-2026-94597
- Write-up quality: 7/10
- Original: https://github.com/advisories/GHSA-2cvj-x8hg-6wcq
- Library page: https://bugbountylibrary.com/r/ghsa%3AGHSA-2cvj-x8hg-6wcq
- Tags: area:web domain:web impact:rce kind:research platform:ghsa sev:high tech:php technique:chained technique:incomplete-fix vuln:file-upload vuln:rce

**Target:** File upload pipeline (Upload::save_file) via avatar/banner/comment attachment endpoints
**Root cause:** verify_image() only scanned for `<?php`/`<?=` and missed the `<?` short-open tag; filename sanitizer preserved dots and extension validation only checked the last extension; the generated .htaccess only blocked `.php` at end of URI.
**Steps:**
1. Upload a valid GIF with PHP code appended after image data, using a `<?` short-open tag payload.
2. Name the file `shell.php.jpg` so the sanitizer keeps the embedded `.php` and extension check sees only `.jpg`.
3. Upload passes verify_image(), filename sanitizer, extension validation, and .htaccess rule.
4. On Apache mod_php with `AddHandler application/x-httpd-php .php` and `short_open_tag = On`, request the uploaded file to execute the appended PHP.
**How found:** Reporter analyzed the upload pipeline and identified four independent weaknesses that could be chained: incomplete tag scanning, dot-preserving sanitizer, last-extension-only check, and end-anchored .htaccess rule.
**Exploitation:** Attacker uploads polyglot via avatar/banner/comment attachment endpoint; on vulnerable Apache/mod_php config the file executes as PHP under www-data, giving OS command execution, DB credential disclosure, file read/write, and internal/cloud metadata pivoting.
**Escalation:** From upload validation bypass to full RCE by relying on server config (short_open_tag On + mod_php AddHandler) to execute the embedded short-tag PHP.
**Insight:** When auditing upload filters, check each layer independently for gaps (short tags, embedded dots, last-extension-only checks, end-anchored rewrite rules) and chain them; polyglots with `<?` short tags bypass scanners that only look for `<?php`.

