모의해킹/Dreamhack

simple_sqli [WEB LEVEL 1]

철민1234 2023. 3. 20. 22:16
728x90

문제 정보

 

 

로그인 페이지

기본적으로 로그인 페이지 쿼리는 select * from user where id='{ }' and pw='{}' 이러한 쿼리 형태입니다. 

 

 

문제 풀이

이 문제의 쿼리 형태는 select * from users where userid="{userid}" and userpassword="{userpassword}"입니다.

userid 값에는 admin이 들어가고 "(쌍따옴표)를 뒤에 넣어 형식을 맞춰 줍니다.

그다음 and 문으로 뒤에 값을 참으로 만든 다음 --(주석)을 사용해 뒤 부분을 생략해 줍니다. 

완성된 쿼리는 select * from users where userid="{admin"and1=1--}" and userpassword="{userpassword}"입니다.