harden: reduce PATH hijacking risk for xdg desktop tools#2865
Conversation
DesktopEntryUtils
|
Hm, from my understanding, if attacker can change environment variables or put files in system directories mean that system already compromised to the point attacker can directly execute malicious binary, so jadx not needed 🤣 Maybe someone can correct me or suggest better solution, so I will keep this PR open for some time. |
|
Thanks for taking a look. I agree that calling this “HIGH severity” is probably overstated. The issue I was trying to address is narrower: jadx resolves xdg-desktop-menu and xdg-icon-resource through PATH before invoking them. In a hostile or unusual launch environment, this could allow PATH hijacking when the desktop-entry installation flow is triggered. That said, I agree this requires the attacker to already influence the user’s environment or filesystem, so it is better described as defensive hardening rather than a standalone vulnerability. I also see your point that hard-coding system directories is not ideal and may hurt portability. A better approach might be to either:
I'll revise the PR accordingly. |
I agree, this seems like a non-issue. "Outside the threat model", one might say. FWIW, on my system, |
Summary
This PR attempts to harden desktop-entry installation in
jadx-guiby avoiding unintended execution ofxdg-desktop-menuorxdg-icon-resourcefrom an unexpected location inPATH.Context
The current implementation resolves the xdg helper commands from
PATHand invokes them withProcessBuilderduring desktop integration.This is not shell command injection: arguments are passed directly to
ProcessBuilder, not through a shell. The concern is narrower: in a hostile or unusual launch environment, a modifiedPATHcould cause jadx to execute a different binary namedxdg-desktop-menuorxdg-icon-resource.Security impact
This should be considered defensive hardening rather than a standalone high-severity vulnerability.
An attacker would generally already need the ability to influence the user’s environment or place a malicious executable earlier in
PATH, so the practical impact is limited. The goal of this PR is only to reduce one possible executable-resolution footgun in the desktop-entry installation flow.Changes
PATHentries for these helper commands.Notes
I understand the concern that hard-coding binary locations may reduce portability and partially bypass the purpose of
PATH. If preferred, I can revise this to a smaller approach, such as:PATHbehavior,Verification
Automated security fix by OrbisAI Security