Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Escape shell arguments#8

Open
sambostock wants to merge 1 commit into
danday74:masterdanday74/git-diff:masterfrom
sambostock:fix-rcesambostock/git-diff:fix-rceCopy head branch name to clipboard
Open

Escape shell arguments#8
sambostock wants to merge 1 commit into
danday74:masterdanday74/git-diff:masterfrom
sambostock:fix-rcesambostock/git-diff:fix-rceCopy head branch name to clipboard

Conversation

@sambostock

@sambostock sambostock commented Feb 20, 2020

Copy link
Copy Markdown

Passing strings to diff as unescaped shell arguments to printf can result in unexpected (and potentially exploitable) behaviour if the strings contain special characters, such as backticks (`).

This adds a basic test which replicates the bug, and replaces the use of JSON.stringify with a basic escapeShellArg function, adapted from StackOverflow.

It would probably be good to get review from someone with more security knowledge.

@coveralls

coveralls commented Feb 20, 2020

Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling 47d92e9 on sambostock:fix-rce into 39a2290 on danday74:master.

@sambostock sambostock force-pushed the fix-rce branch 2 times, most recently from 235eb91 to 3daf143 Compare February 20, 2020 07:49
@sambostock sambostock requested a review from danday74 February 24, 2020 21:04
Passing strings to diff as unescaped shell arguments to printf can
result in unexpected (and potentially exploitable) behaviour if the
strings contain special characters, such as backticks (`).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.