Skip to content

Commit 5f5621b

Browse files
committed
push changes to class validator
1 parent f6cf3b4 commit 5f5621b

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed
Binary file not shown.

.vs/slnx.sqlite

0 Bytes
Binary file not shown.

class-validator/class-validator_handling.js

+10-11
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
var mysql = require('mysql2');
22
var classValidator = require('class-validator');
3+
34
//var mysql = require('mysql2/promise')
45

56
function bypassedValidation(emailInput, passwordInput, connection) {
67
const sqlquery1 = `SELECT * FROM login WHERE email = ${emailInput} AND password = ${passwordInput}`;
8+
console.log(sqlquery1);
79
return new Promise(function (resolve, reject) {
810
connection.query(sqlquery1, function (error, rows) {
911
if (error) {
@@ -17,22 +19,15 @@ function bypassedValidation(emailInput, passwordInput, connection) {
1719
});
1820

1921
}
22+
2023
class intendedSchema {
2124
email;
22-
password
25+
password;
2326
}
2427

25-
let param = {
26-
email: ' " OR 1=1--',
27-
password: ' " OR 1=1--',
28-
constructor: false
29-
};
30-
31-
3228

3329
function jsonHandle(emailInput)
3430
{
35-
console.log("into the json");
3631
let requirements = {
3732
host: 'localhost',
3833
user: 'root',
@@ -41,7 +36,7 @@ function jsonHandle(emailInput)
4136
};
4237
var connection = mysql.createConnection(requirements);
4338

44-
let test1Param = Object.assign(intendedSchema, param);
39+
let test1Param = Object.assign(intendedSchema, emailInput);
4540
console.log("This is the merged schema:")
4641
console.log(test1Param);
4742

@@ -54,7 +49,11 @@ function jsonHandle(emailInput)
5449
} else {
5550
console.log('valid email and password, user successfully validated. Relevant Database Information:');
5651
bypassedValidation(test1Param.email, test1Param.password, connection).then((results) => {
57-
resolve(results);
52+
53+
if (results.length == 0) {
54+
resolve("No user found");
55+
}
56+
resolve(results);
5857
})
5958

6059
}

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "abusing_hidden_properties_node_js_attack",
33
"version": "1.0.0",
4-
"description": "Implementation of \"Abusing Hidden Properties to Attack the Node.js Ecosystem\"",
5-
"main": "index.js",
4+
"description": "Implementation of \"Abusing Hidden Properties to Attack the Node.js Ecosystem\"",
5+
"main": "index.js",
66
"scripts": {
77
"start": "node index.js",
88
"dev": "node_modules/.bin/nodemon -e js",

0 commit comments

Comments
 (0)