목록전체 글 (33)
D1N0's hacking blog
문제 풀이 코드를 보면 or과 and를 필터링한다 SQL에서 or과 and는 각각 ||, &&로 쓸 수 있다 이때 &&는 url에 직접 쓰지 못하니까 url인코딩해서 %26%26으로 쓰면 된다 첫 번째 풀이 pw=' || id = 'admin';%23 원래 or가 있던 자리에 ||를 넣었다
문제 풀이 언뜻 보면 pw=' or id = 'admin';%23으로 풀 수 있을 것 같지만 코드를 보면 공백을 필터링하고 있다 불필요한 공백을 지우더라도 or과 id는 띄워야 한다 SQL에서 공백은 Tab, Line Feed, Carrage Return, 주석, 괄호, + 등으로 우회 가능하다 첫 번째 풀이 pw='or%09id='admin';%23 공백이 필요한 부분에 Tab(%09)을 넣어 필터링을 우회했다 불필요한 공백을 다 지웠지만 중간중간 Tab을 더 넣어도 문제는 없다 Tab 대신 LF(%0a), CR(%0d)를 넣어도 된다 두 번째 풀이 pw='or/**/id='admin';%23 pw='or(id)='admin';%23 pw='or%2bid='admin';%23 각각 주석, 괄호, +로 ..
Blind SQL injection이란? DB에 대한 메시지를 알 수 없는 경우 사용되는 공격 방법이다 페이지가 잘 나오는지, 에러가 나는지를 통해 각 조건의 참, 거짓을 받아서 DB를 알아낼 수 있다 예를 들어 up/down게임처럼 원하는 문자가 7인걸 알기 위해 5보다 큰가? T -> 8보다 큰가? F -> 6인가? F -> 7인가? T의 순서로 원하는 정보를 얻어오는 것과 비슷하다 문제 풀이 코드를 보면 SQL문 외에 직접적으로 pw를 비교하는 부분이 있기 때문에 pw를 구해야 한다 SQL 쿼리에 SQL injection 취약점이 존재하므로 Blind SQL injection으로 pw를 알아낼 수 있다 STEP 0 - SQL injection 취약점 확인 pw=' or id='admin' and 1..