Summary
CherryTree through version 1.7.2 contains an OS command injection vulnerability in the link-click handling logic. When the non-default Custom Web Link Clicked Action option is enabled, a victim who opens a crafted document and clicks a malicious web link may execute attacker-controlled commands with the victim's privileges.
CherryTree through version 1.7.2 contains an OS command injection vulnerability in the link-click handling logic. When the non-default Custom Web Link Clicked Action option is enabled, a victim who opens a crafted document and clicks a malicious web link may execute attacker-controlled commands with the victim's privileges.
Affected context
The vulnerability occurs in CherryTree's CtActions::link_clicked handler when the Custom Web Link Clicked Action setting is enabled. Risk is present when documents containing attacker-controlled links can be opened by a user and those links are passed to a shell through std::system without adequate argument isolation.
The vulnerability occurs in CherryTree's CtActions::link_clicked handler when the Custom Web Link Clicked Action setting is enabled. Risk is present when documents containing attacker-controlled links can be opened by a user and those links are passed to a shell through std::system without adequate argument isolation.
Exploit preconditions
- Attack surface: CherryTree document link handling
- Required access: The attacker must be able to provide or influence a CherryTree document containing a crafted web link.
- Trigger point: The victim clicks the link while the non-default Custom Web Link Clicked Action option is enabled.
- Why exploitation is possible: Link content is incorporated into a command and passed unquoted to
std::system, allowing shell metacharacters to alter command interpretation.
- Attack surface: CherryTree document link handling
- Required access: The attacker must be able to provide or influence a CherryTree document containing a crafted web link.
- Trigger point: The victim clicks the link while the non-default Custom Web Link Clicked Action option is enabled.
- Why exploitation is possible: Link content is incorporated into a command and passed unquoted to
std::system, allowing shell metacharacters to alter command interpretation.
Why this happens
The underlying flaw is the construction of an operating-system command from link data that is not treated as untrusted input. Passing that data to std::system without strict validation, safe argument handling, or shell avoidance allows shell metacharacters to be interpreted as control syntax. This behavior maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command.
The underlying flaw is the construction of an operating-system command from link data that is not treated as untrusted input. Passing that data to std::system without strict validation, safe argument handling, or shell avoidance allows shell metacharacters to be interpreted as control syntax. This behavior maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command.
Potential impact
- An attacker may execute arbitrary commands with the victim's operating-system privileges.
- Sensitive local files or credentials could be accessed or modified.
- The application or user workspace could be compromised.
- Malware or persistence mechanisms could be installed, depending on available privileges.
- The affected host could be used as a foothold for further activity.
- An attacker may execute arbitrary commands with the victim's operating-system privileges.
- Sensitive local files or credentials could be accessed or modified.
- The application or user workspace could be compromised.
- Malware or persistence mechanisms could be installed, depending on available privileges.
- The affected host could be used as a foothold for further activity.
General mitigation guidance
Mitigation generally focuses on removing shell interpretation from link actions and reducing trust in document-provided URLs.
Common defensive patterns include:
- Prefer direct process or API invocation with structured arguments instead of shell-based execution.
- Permit only explicitly supported URL schemes, destinations, and action formats.
- Treat document links as untrusted input and apply strict parsing and allowlisting before any action.
- Keep custom command execution disabled by default unless there is a justified operational need.
- Run the application with least-privilege user permissions and limit access to sensitive resources.
- Provide user confirmation and clear context before invoking external applications or commands.
Mitigation generally focuses on removing shell interpretation from link actions and reducing trust in document-provided URLs.
Common defensive patterns include:
- Prefer direct process or API invocation with structured arguments instead of shell-based execution.
- Permit only explicitly supported URL schemes, destinations, and action formats.
- Treat document links as untrusted input and apply strict parsing and allowlisting before any action.
- Keep custom command execution disabled by default unless there is a justified operational need.
- Run the application with least-privilege user permissions and limit access to sensitive resources.
- Provide user confirmation and clear context before invoking external applications or commands.
How teams detect issues like this
Organizations can identify related risks through:
- Static analysis searches for
system, shell-spawning APIs, and command construction involving URLs or document content. - Code review checks for unquoted or concatenated user-controlled values in process commands.
- Tests using metacharacter-containing inputs to verify that link handlers do not invoke shell syntax.
- Policy enforcement that restricts custom command actions and permits only approved URL schemes.
- Runtime monitoring for unexpected child processes launched by the application.
Automated security review tools may help flag shell invocation and insufficient input validation, but findings should be confirmed against the application's execution flow.
Organizations can identify related risks through:
- Static analysis searches for
system, shell-spawning APIs, and command construction involving URLs or document content. - Code review checks for unquoted or concatenated user-controlled values in process commands.
- Tests using metacharacter-containing inputs to verify that link handlers do not invoke shell syntax.
- Policy enforcement that restricts custom command actions and permits only approved URL schemes.
- Runtime monitoring for unexpected child processes launched by the application.
Automated security review tools may help flag shell invocation and insufficient input validation, but findings should be confirmed against the application's execution flow.

