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

Intentional vulnerable #32

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Intentional vulnerable #32

wants to merge 4 commits into from

Conversation

shwetarkadam
Copy link
Contributor

No description provided.

Comment on lines +23 to +39
app.get('/login', (req, res) => {
const user = req.query.username;
const pass = req.query.password;

// Concatenation using a different pattern to obscure SQL injection vulnerability
const query = ['SELECT * FROM users WHERE username = "', user, '" AND password = "', pass, '"'].join('');

db.get(query, (err, row) => {
if (err) {
res.status(500).send('Internal Server Error');
} else if (row) {
res.send('Login successful!');
} else {
res.send('Invalid credentials');
}
});
});

Check failure

Code scanning / CodeQL

Missing rate limiting High

This route handler performs
a database access
, but is not rate-limited.
// Slightly obfuscated SQL Injection vulnerability
app.get('/login', (req, res) => {
const user = req.query.username;
const pass = req.query.password;

Check warning

Code scanning / CodeQL

Sensitive data read from GET request Medium

Route handler
for GET requests uses query parameter as sensitive data.
// Concatenation using a different pattern to obscure SQL injection vulnerability
const query = ['SELECT * FROM users WHERE username = "', user, '" AND password = "', pass, '"'].join('');

db.get(query, (err, row) => {

Check failure

Code scanning / CodeQL

Database query built from user-controlled sources High

This query string depends on a
user-provided value
.
This query string depends on a
user-provided value
.
};

// Render profile with potential XSS
res.send(renderProfile(username));

Check failure

Code scanning / CodeQL

Reflected cross-site scripting High

Cross-site scripting vulnerability due to a
user-provided value
.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant