CVE-2022-24803
📋 TL;DR
CVE-2022-24803 is a critical command injection vulnerability in Asciidoctor-include-ext that allows attackers to execute arbitrary system commands when processing untrusted AsciiDoc input. This affects all systems using versions before 0.4.0 to render user-supplied content, even with security features like allow-uri-read disabled.
💻 Affected Systems
- asciidoctor-include-ext
📦 What is this software?
Asciidoctor Include Ext by Asciidoctor Include Ext Project
⚠️ Risk & Real-World Impact
Worst Case
Full system compromise allowing attacker to execute arbitrary commands with the privileges of the Asciidoctor process, potentially leading to data theft, ransomware deployment, or complete host takeover.
Likely Case
Remote code execution leading to data exfiltration, installation of backdoors, or lateral movement within the network.
If Mitigated
Limited impact if proper input validation and sandboxing are implemented, though command injection would still be possible.
🎯 Exploit Status
Exploitation requires the ability to supply AsciiDoc content for processing. Public proof-of-concept exists in the advisory.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 0.4.0
Vendor Advisory: https://github.com/jirutka/asciidoctor-include-ext/security/advisories/GHSA-v222-6mr4-qj29
Restart Required: No
Instructions:
1. Update asciidoctor-include-ext to version 0.4.0 or later using your package manager. 2. For Ruby projects: Update Gemfile to specify '~> 0.4.0' and run 'bundle update asciidoctor-include-ext'. 3. Verify no older versions are installed.
🔧 Temporary Workarounds
Disable include processing for untrusted content
allConfigure Asciidoctor to not process include directives when handling user-supplied input
Set safe mode to at least SAFE or higher when processing untrusted content
Input sanitization
allStrip or escape include directives from user input before processing
Use regex to remove include:: directives: content.gsub(/include::.*?\[\]/m, '')
🧯 If You Can't Patch
- Isolate the vulnerable system in a network segment with strict egress filtering
- Implement application-level allowlisting of trusted include sources only
🔍 How to Verify
Check if Vulnerable:
Check the installed version of asciidoctor-include-ext. If version is < 0.4.0 and you process untrusted AsciiDoc content, you are vulnerable.
Check Version:
gem list asciidoctor-include-ext | grep asciidoctor-include-ext
Verify Fix Applied:
Verify asciidoctor-include-ext version is 0.4.0 or higher using 'gem list asciidoctor-include-ext' or check package manager.
📡 Detection & Monitoring
Log Indicators:
- Unusual system command execution from Asciidoctor process
- Include directives with suspicious paths or shell commands
- Failed include attempts with command-like syntax
Network Indicators:
- Outbound connections from Asciidoctor process to unexpected destinations
- Command and control traffic patterns
SIEM Query:
process.name:"ruby" AND process.args:"asciidoctor" AND process.args:"include::" AND process.args:"$"
🔗 References
- https://github.com/jirutka/asciidoctor-include-ext/commit/c7ea001a597c7033575342c51483dab7b87ae155
- https://github.com/jirutka/asciidoctor-include-ext/commit/cbaccf3de533cbca224bf61d0b74e4b84d41d8ee
- https://github.com/jirutka/asciidoctor-include-ext/security/advisories/GHSA-v222-6mr4-qj29
- https://github.com/jirutka/asciidoctor-include-ext/commit/c7ea001a597c7033575342c51483dab7b87ae155
- https://github.com/jirutka/asciidoctor-include-ext/commit/cbaccf3de533cbca224bf61d0b74e4b84d41d8ee
- https://github.com/jirutka/asciidoctor-include-ext/security/advisories/GHSA-v222-6mr4-qj29