GitHub Advisoryadvisory · RubyGems
GHSA-v222-6mr4-qj29 Command Injection vulnerability in asciidoctor-include-ext
CRITICAL
Official page ↗
- Aliases
- CVE-2022-24803
- Ecosystem
- RubyGems
- Packages
- asciidoctor-include-ext
- Severity
- Critical
- CVSS vector
- CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
- Weaknesses
- CWE-78
- Reviewed
- 2022-03-31
Affected packages
• RubyGems asciidoctor-include-ext: < 0.4.0 → fixed in 0.4.0
Description
Impact
Applications using Asciidoctor (Ruby) with asciidoctor-include-ext (prior to version 0.4.0), which render user-supplied input in AsciiDoc markup, may allow an attacker to execute arbitrary system commands on the host operating system. ~~This attack is possible even when `allow-uri-read` is disabled!~~ (EDIT: it’s not)
Patches
The vulnerability has been fixed in commit c7ea001 (and further improved in cbaccf3), which is included in version 0.4.0.
Workarounds
```rb
require 'asciidoctor/include_ext'
class Asciidoctor::IncludeExt::IncludeProcessor
# Overrides superclass private method to mitigate Command Injection
# vulnerability in asciidoctor-include-ext <0.4.0.
def target_uri?(target)
target.downcase.start_with?('http://', 'https://') \
&& URI.parse(target).is_a?(URI::HTTP)
rescue URI::InvalidURIError
false
end
end
```
References
• https://sakurity.com/blog/2015/02/28/openuri.html
Credits
This vulnerability was discovered by Joern Schneeweisz from the GitLab Security Research Team.
For more information
See commit message c7ea001.
If you have any questions or comments about this advisory open an issue in jirutka/asciidoctor-include-ext.
Related
Alias · CVE (1)
- CVE-2022-24803 Asciidoctor-include-ext is Asciidoctor’s standard include processor reimplemented as an extension. vulnerability
Weakness · CWE (1)
- CWE-78 Improper Neutralization of Special Elements used in an OS Command weakness
References
- https://github.com/jirutka/asciidoctor-include-ext/security/advisories/GHSA-v222-6mr4-qj29 web
- https://nvd.nist.gov/vuln/detail/CVE-2022-24803 advisory
- https://github.com/jirutka/asciidoctor-include-ext/commit/c7ea001a597c7033575342c51483dab7b87ae155 web
- https://github.com/jirutka/asciidoctor-include-ext/commit/cbaccf3de533cbca224bf61d0b74e4b84d41d8ee web
- https://github.com/jirutka/asciidoctor-include-ext package
- https://github.com/rubysec/ruby-advisory-db/blob/master/gems/asciidoctor-include-ext/CVE-2022-24803.yml web