Closed huntr-helper closed 3 years ago
@zpbrent To pass the CI, you will also need to
cc @xirzec for review and follow ups on the CVE
@ramya-rao-a & @xirzec - done, thanks! π°
I'm working on getting a CVE number to stick in the changelog, so please hold for that before merging.
CVE number issued: CVE-2021-28458. @JamieSlome @zpbrent thank you for your patience. Can one of you add this ID to the changelog so we can merge and publish?
@xirzec - done, thanks for the CVE assignment! π°
@ramya-rao-a can you give owner approval when you get a moment?
Thanks @zpbrent @joheredi will be handling the release
I'm working on the release now . I will post an update soon once this change has been released!
/cc: @ramya-rao-a, @zpbrent
v3.0.8 has been released: https://www.npmjs.com/package/@azure/ms-rest-nodeauth/v/3.0.8
/cc: @ramya-rao-a, @zpbrent
@zpbrent (https://huntr.dev/users/zpbrent) has fixed a potential Command Injection vulnerability in your repository π¨. For more information, visit our website (https://huntr.dev/) or click the bounty URL below...
Q | A Version Affected | * Bug Fix | YES Original Pull Request | https://github.com/418sec/ms-rest-nodeauth/pull/1
If you are happy with this disclosure, we would love to get a CVE assigned to the vulnerability. Feel free to credit @zpbrent, the discloser found in the bounty URL (below) and @huntr-helper.
User Comments:
π Metadata *
The core function execAz() which is purposely used for az command can be injected with arbitrary other OS commands. Also the attackers can exploit this vulnerability by calling AzureCliCredentials.setDefaultSubscription("OS command") from the Azure CLI.
Bounty URL: https://www.huntr.dev/bounties/1-npm-@azure/ms-rest-nodeauth/
βοΈ Description *
Using execFile() to replace exec().
π» Technical Description *
The use of the child_process function exec() is highly discouraged if you accept user input and don't sanitize/escape them. This PR replaces it with execFile() which mitigates any possible Command Injections as it accepts input as arrays.
π Proof of Concept (PoC) *
// PoC.js auth = require('@azure/ms-rest-nodeauth'); auth.AzureCliCredentials.setDefaultSubscription('$(touch pzhou@shu)');
π₯ Proof of Fix (PoF) *
Using 'execFile(
az
, [${cmd}
,--out json
], { encoding: "utf8" }, (error, stdout) => {...' to replacing 'exec(az ${cmd} --out json
, { encoding: "utf8" }, (error, stdout) => {...'π User Acceptance Testing (UAT)
(node:7156) ExperimentalWarning: The fs.promises API is experimental
(node:7179) ExperimentalWarning: The fs.promises API is experimental
π Relates to...
https://www.huntr.dev/bounties/1-npm-@azure/ms-rest-nodeauth/