Security/Write Up

[Dreamhack] simple_sqli

2er0127 2023. 6. 4. 20:58

SQL Injection 로드맵을 공부했으면 5초면 풀 수 있는 문제이다.

 

 

login() 함수를 보면 useridadmin일 때 로그인을 하면 FLAG가 나온다.

 

 

 

그리고 쿼리는

select * from users where userid="{userid}" and userpassword="{userpassword}"

라고 한다.

 

 

 

나는 주석을 이용한 공격 쿼리를 아이디에 넣고, 비밀번호는 아무거나 입력해줬다.

admin"--

 

 

 

 

위 쿼리를 넣으면

select * from users where userid="admin"-- " and userpassword="1234"

가 된다.

 

 

--주석을 의미하므로 잘못된 비밀번호를 입력해도 -- 뒤는 모두 주석 처리가 되기 때문에 알맞은 쿼리문으로 인식하게 된다.

 

 

 

 

728x90