-
Notifications
You must be signed in to change notification settings - Fork 930
fix: RCE vulnerability from CVE-2025-11953 #2735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| } | ||
|
|
||
| // Reconstruct URL with proper encoding to prevent command injection | ||
| // The URL constructor doesn't automatically encode special characters like | in query strings, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be specific, it encodes special characters, but only sets of them in each URL part 1. For example, | is encoded in userinfo:
new URL('https://user|:[email protected]')`
// https://user%7C:[email protected]/Current implementation double-encodes several characters for that reason; for example, whitespaces:
const parsedUrl = new URL('https://example.com/?#some hash')
// https://example.com/?#some%20hash
const sanitizedUrl = new URL(parsedUrl.origin);
// ...
console.log(sanitizedUrl.href)
// https://example.com/#some%2520hashA simpler approach could be:
const sanitizedUrl = encodeURI(url);Footnotes
| jest.restoreAllMocks(); | ||
| }); | ||
|
|
||
| it('should sanitize URL with pipe character to prevent RCE', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
This is likely still fragile, but better than it was. On a side note, this can (still) be exploited to exfiltrate some environment variables; possibilities are more limited, though. For example, |
Summary
Continuation of the fix that landed in 1508990, that prevents RCE using a spoofed URL with
|character, such as: https://evil.com?|calc.exe.cc @633kh4ck @mbaraniak-exodus