SQL Injection 로드맵을 공부했으면 5초면 풀 수 있는 문제이다.
login() 함수를 보면 userid가 admin일 때 로그인을 하면 FLAG가 나온다.
그리고 쿼리는
select * from users where userid="{userid}" and userpassword="{userpassword}"
라고 한다.
나는 주석을 이용한 공격 쿼리를 아이디에 넣고, 비밀번호는 아무거나 입력해줬다.
admin"--
위 쿼리를 넣으면
select * from users where userid="admin"-- " and userpassword="1234"
가 된다.
-- 는 주석을 의미하므로 잘못된 비밀번호를 입력해도 -- 뒤는 모두 주석 처리가 되기 때문에 알맞은 쿼리문으로 인식하게 된다.
728x90
'Security > Write Up' 카테고리의 다른 글
[Dreamhack] error based sql injection (0) | 2023.06.11 |
---|---|
[Dreamhack] Mango (0) | 2023.06.11 |
[Dreamhack] csrf-2 (0) | 2023.06.02 |
[Dreamhack] csrf-1 (0) | 2023.05.31 |
[Dreamhack] XSS Filtering Bypass (2) | 2023.05.30 |