Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Fix Arbitary Code Execution#1

Merged
JamieSlome merged 1 commit into418sec:masterfrom
alromh87:master
Sep 15, 2020
Merged

Fix Arbitary Code Execution#1
JamieSlome merged 1 commit into418sec:masterfrom
alromh87:master

Conversation

@alromh87
Copy link

@alromh87 alromh87 commented Sep 9, 2020

📊 Metadata *

Bounty URL: https://www.huntr.dev/bounties/1-npm-gify

⚙️ Description *

node-gify was vulnerable against RCE and arbitrary command injection cause some user supplied inputs were taken and formatted inside the exec() function without prior validation.
After update Arbitary Code Execution is avoided by using execFile instead of exec

💻 Technical Description *

Arbitary Code Execution is avoided by using execFile() instead of exec() and passing arguments via parameters instead of composing string

🐛 Proof of Concept (PoC) *

Install the package and run the below code:

// poc.js
var gify = require("./");
gify("out.mp4\"`'; touch HACKED; #", 'out.gif\';touch HACKED; #', e => { console.log(e)});

It will create a file named HACKED in the working directory.
Captura de pantalla de 2020-09-09 20-36-33

🔥 Proof of Fix (PoF) *

After fix no file is created
Captura de pantalla de 2020-09-09 20-35-50

👍 User Acceptance Testing (UAT)

Commands can be executed normally

Copy link

@toufik-airane toufik-airane left a comment

Choose a reason for hiding this comment

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

Awesome!

@JamieSlome JamieSlome merged commit 2f1f66d into 418sec:master Sep 15, 2020
@huntr-helper
Copy link

Congratulations alromh87 - your fix has been selected! 🎉

Thanks for being part of the community & helping secure the world's open source code.
If you have any questions, please respond in the comments section, or hit us up on Discord. Your bounty is on its way - keep hunting!

Come join us on Discord

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants