CVE-2022-21690: onionshare-cli Improper Input Sanitation
Summary
CVE-2022-21690: Between September 26, 2021 and October 8, 2021, Radically Open Security conducted a penetration test of OnionShare 2.4, funded by the Open Technology Fund's Red Team lab. Affects onionshare-cli versions < 2.5. Fixed in 2.5. How to fix ↓
Also tracked for
- onionshare · Debian:11
The same CVE-2022-21690 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
The onionshare-cli package is a Python package available on PyPI. It is a command-line interface for OnionShare, a tool that allows users to securely and anonymously share files over the Tor network. OnionShare provides a way to create an Onion service and share its address with others. The onionshare-cli package is used to interact with OnionShare from the command line. It is vulnerable to an improper input sanitation issue that can lead to the rendering of arbitrary HTML in the server desktop application.
Vulnerability Detail
The vulnerability (OTF-001) in onionshare-cli arises from the lack of input sanitization in the path parameter of the requested URL. This parameter is not properly sanitized before being passed to the constructor of the QLabel class in the QT frontend. As a result, an attacker with knowledge of the Onion service address can inject crafted HTML code, which will be rendered as a subset of HTML 4 markup (QT RichText editor) in the Onionshare frontend. This could potentially lead to remote code execution if there are 0-day vulnerabilities in the image rendering components of the QT framework. The impact of this vulnerability is elevated, as it requires the desktop application with rendered history.
How To Fix
Latest published version: 2.7.0 as of 22 Oct 2026
pip install --upgrade "onionshare-cli==2.7.0"
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
2.5
This is the first release that contains the fix.
pip install --upgrade "onionshare-cli==2.5"
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
A possible workaround for this vulnerability is to manually define the text format of the QLabel via the setTextFormat() method. By explicitly setting the text format to plain text, any injected HTML code will be treated as plain text and not rendered as HTML. Here is an example of how to implement this workaround:
# Manually define the text format
label.setTextFormat(Qt.PlainText)
Conclusion
In conclusion, the onionshare-cli package is vulnerable to an improper input sanitation issue that allows for the injection of arbitrary HTML code in the server desktop application. To mitigate this vulnerability, it is recommended to update to version 2.5 of onionshare-cli, properly sanitize the path parameter, and set the text format to plain text. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for onionshare-cli →
FAQ
onionshare-cli is a Python package that provides a command-line interface for OnionShare, a tool for securely sharing files over the Tor network.
The impact of this vulnerability is elevated, as it allows an attacker to inject arbitrary HTML code in the server desktop application. However, remote code execution is only possible if there are 0-day vulnerabilities in the image rendering components of the QT framework.
To fix this vulnerability, you should update onionshare-cli to version 2.5. Additionally, ensure that the path parameter is properly sanitized and that the setTextFormat() method is called to set the text format to plain text.
Yes, a possible workaround is to manually define the text format of the QLabel via the setTextFormat() method. By setting the text format to plain text, any injected HTML code will be treated as plain text and not rendered as HTML.
You can find more information about OnionShare on the official website: https://onionshare.org
Related vulnerabilities
Recent vulnerabilities recorded for onionshare-cli.