Security Fix for Arbitrary Code Execution - huntr.dev #17
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
https://huntr.dev/users/alromh87 has fixed the Arbitrary Code Execution vulnerability 馃敤. alromh87 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#2
Vulnerability README | https://github.com/418sec/huntr/blob/master/bounties/npm/infraserver/1/README.md
User Comments:
馃搳 Metadata *
infraserver is a data server, this package are vulnerable to Arbitrary Code Execution due to the default usage of the function load() of the package js-yaml instead of its secure replacement, safeLoad().
It took my a little while to implement the POC properly, but now its cleanly solved
Bounty URL: https://www.huntr.dev/bounties/1-npm-infraserver
鈿欙笍 Description *
I replaced the use of yaml.load() with yaml.safeLoad() and added handling of error if loading fails.
馃捇 Technical Description *
Two vulnerable endpoints where found on infra POST and PUT
Code execution is avoided by using yamlLoad(), but just replacing the function (as the other PR) malicious payload would trigger DoS, so I avoided that by using try ... catch.
馃悰 Proof of Concept (PoC) *
git clone https://github.com/xuemen/Infra
cd infra
node server/Infra.data.js
python poc.py
Before fix
Only repleacing use of function (incomplete fix)
馃敟 Proof of Fix (PoF) *
After fix no code is executed and server stays online
馃憤 User Acceptance Testing (UAT)
Functionality unafected