Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test/vulns-outside-30_08_24_18_43 #15

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions sql_injection.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
function checkLogin(req, db) {
const sqlQuery =
"SELECT email FROM credentials WHERE " +
"email = '" + req.body.email + "' AND " +
"password = '" + req.body.password + "'";

doQuery(sqlQuery, [])
}

function doQuery(query, args) {
db.query(query, args, (err, result) => {
Copy link

Choose a reason for hiding this comment

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

  SQL Injection

Unsanitized input from the HTTP request body flows into query, where it is used in an SQL query. This may result in an SQL Injection vulnerability.

CWE-89 | Priority score 754 | Line 11

if (err) {
return false;
}

return result.length !== 0;
});
}