Skip to content
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

Security Fix for Remote Code Execution - huntr.dev #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

huntr-helper
Copy link

https://huntr.dev/app/users/Asjidkalam has fixed the Remote Code Execution vulnerability 🔨. Asjidkalam has been awarded $25 for fixing the vulnerability through the huntr bug bounty program 💵. Think you could fix a vulnerability like this?

Get involved at https://huntr.dev/

Q | A
Version Affected | ALL
Bug Fix | YES
Original Pull Request | 418sec#1
GitHub Issue URL | #2
Vulnerability README | https://github.com/418sec/huntr/blob/master/bounties/npm/node-count-git-tags/1/README.md

User Comments:

📊 Metadata *

Remote Code Execution Vulnerability

Bounty URL: https://www.huntr.dev/app/bounties/open/1-npm-node-count-git-tags

⚙️ Description *

Fixed the code execution by escaping the shell argument using the shell-escape library.

💻 Technical Description *

shell-escape is used to escape and stringify an array of arguments to be executed on the shell. There were multiple instances on the index.js in which the user-supplied input is concatenated into command strings, unsanitized, which is then passed to execa.shellSync() which triggers the code execution. This is mitigated using the shell-escape library.

🐛 Proof of Concept (PoC) *

Create a project with a vulnerable package and run the following snippet and listen to requests on localhost:80.

const countGitTags = require('count-git-tags');
countGitTags({ path: '.git;curl "http://localhost/RCE"' });

before

🔥 Proof of Fix (PoF) *

After applying the fix, the escape-shell module properly sanitizes the user-supplied information before passing into the execa.shellSync(). and the curl command is no more executed. Hence code execution is mitigated.

after

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.

3 participants