Skip to content

Commit

Permalink
Update vulnerable-server.js
Browse files Browse the repository at this point in the history
  • Loading branch information
BillReyor authored May 11, 2024
1 parent b0af3ca commit bd63737
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions workshop/VulnerableAppThree/vulnerable-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,15 @@ app.get('/', (req, res) => {
app.listen(3000, () => {
console.log('Server running on http://localhost:3000');
});
app.get('/exec', (req, res) => {
const { cmd } = req.query;
require('child_process').exec(cmd, (error, stdout, stderr) => {

Check failure

Code scanning / CodeQL

Uncontrolled command line Critical

This command line depends on a
user-provided value
.
if (error) {
return res.status(500).send(`Error: ${error.message}`);
}
if (stderr) {
return res.status(500).send(`Stderr: ${stderr}`);
}
res.send(`Command output: ${stdout}`);
});
});

Check failure

Code scanning / CodeQL

Missing rate limiting High

This route handler performs
a system command
, but is not rate-limited.

0 comments on commit bd63737

Please sign in to comment.