Skip to content

fix: RCE vulnerability from CVE-2025-11953 - #2735

Closed
thymikee wants to merge 3 commits into
mainfrom
fix/rce
Closed

fix: RCE vulnerability from CVE-2025-11953#2735
thymikee wants to merge 3 commits into
mainfrom
fix/rce

Conversation

@thymikee

@thymikeethymikee commented Nov 12, 2025

Copy link
Copy Markdown
Member

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

@mbaraniak-exodus

Copy link
Copy Markdown

@thymikee,
The fix seems reasonable, unless you switch in the future to a new version of open, which uses PS underneath. Then you will need escape also $(, etc.
Be aware of (non-default) delayed expansion, which will make such syntax possible !VAR!

}

// Reconstruct URL with proper encoding to prevent command injection
// The URL constructor doesn't automatically encode special characters like | in query strings,

@633kh4ck633kh4ckNov 12, 2025

Copy link
Copy Markdown

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:

newURL('https://user|:pass@example.com')`
// https://user%7C:pass@example.com/

Current implementation double-encodes several characters for that reason; for example, whitespaces:

constparsedUrl=newURL('https://example.com/?#some hash')// https://example.com/?#some%20hashconstsanitizedUrl=newURL(parsedUrl.origin);// ...console.log(sanitizedUrl.href)// https://example.com/#some%2520hash

A simpler approach could be:

constsanitizedUrl=encodeURI(url);

Footnotes

  1. https://url.spec.whatwg.org/#percent-encoded-bytes

jest.restoreAllMocks();
});

it('should sanitize URL with pipe character to prevent RCE', async () => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@633kh4ck

633kh4ck commented Nov 12, 2025

Copy link
Copy Markdown

For posterity: 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, https://example.com/?a=%¾TA% is encoded to https://example.com/?a=%25%C2%BETA%25 (note %BETA%).

@m01e-40x

Copy link
Copy Markdown

@thymikee hi,
may I ask why this fix PR has not been merged into the main branch and the latest release version?

@thymikee

Copy link
Copy Markdown
MemberAuthor

Uh, I wanted to followup with a more robust fix, but then forgot about it. I'll try to prioritize this soon. Maintaining Community CLI is not my primary focus and anyone is free to contribute

@huntie

Copy link
Copy Markdown
Collaborator

@thymikee Opened #2758 as an alternative. Uses strict-url-sanitise and continues to cover logic with our own unit tests.

@thymikee

Copy link
Copy Markdown
MemberAuthor

Thank you @huntie, let's move the discussion there!

leotm added a commit to leotm/react-native-template-new-architecture that referenced this pull request Jun 30, 2026
- revert d1b5e9c patch fix
- bump @react-native-community/cli
- bump @react-native-community/cli-platform-android
- bump @react-native-community/cli-platform-ios
Resolve: #1994
Supersedes
- #1980
- #2012
- #2013
Ref
- react-native-community/template#231
- react-native-community/template#232
- react/react-native#57344
Includes URL sanitisation fix (v20.1.1 regression)
- react-native-community/cli#2814
- react-native-community/cli#2812
- react-native-community/cli#2758
- react-native-community/cli#2735
- react-native-community/cli#2697
leotm added a commit to leotm/react-native-template-new-architecture that referenced this pull request Jun 30, 2026
- revert d1b5e9c patch fix
- bump @react-native-community/cli
- bump @react-native-community/cli-platform-android
- bump @react-native-community/cli-platform-ios
Resolve: #1994
Supersedes
- #1980
- #2012
- #2013
Ref
- react-native-community/template#231
- react-native-community/template#232
- react/react-native#57344
Includes URL sanitisation fix (v20.1.1 regression)
- react-native-community/cli#2814
- react-native-community/cli#2812
- react-native-community/cli#2758
- react-native-community/cli#2735
- react-native-community/cli#2697
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@thymikee@mbaraniak-exodus@633kh4ck@m01e-40x@huntie@szymonrybczak