취약점) XPath Injection
XPath Injection
- XML 구조에 악의적인 행위를 일으키는 내용을 삽입하거나 Xpath를 조작하여 XML의 내용을 노출하는 취약점
XPath 란
- 일종의 퀄리로 XML 데이터베이스 내용을 선택하고 조작하기 위하여 사용
https://ko.wikipedia.org/wiki/XPath
XPath - 위키백과, 우리 모두의 백과사전
위키백과, 우리 모두의 백과사전.
ko.wikipedia.org
명령어 | 설명 |
/ | 최상위 노드 |
// | 현재 노드로부터 모든 노드 조회 |
* | 모든 노드 조회 |
. | 현재 노드 |
.. | 현재 상위 노드 접근 |
parent | 현재 노드의 부모 노드 |
child | 현재 노드의 자식 노드 |
[ ] | 조건문 |
node() | 현재 노드로부터 모든 노드 조회 |
* 출처 : 비박스 환경을 활용한 웹 모의해킹 완벽 실습 (p.162 표6-1 XPath 명령어)
XML 데이터베이스
https://thebook.io/006977/ch01/01/04/04/
모두의 SQL: XML 데이터베이스
thebook.io
XPath Injection cheetsheet
- SQL 인젝션의 공격 패턴과 유사한 형식. 다만 SQL 쿼리가 아닌 XPath 이용.
https://cheatsheet.haax.fr/web-pentest/injections/server-side-injections/xpath/
Offensive Security Cheatsheet
Navigation : Open Source Intelligence (OSINT) Web Pentest - Resources Discovery - Applicative Scans - Content Management Systems (CMS) - Injections -- Server Side Injections --- SQL Injections --- NoSQL Injections --- LDAP Injections --- XPath Injections -
cheatsheet.haax.fr
XPath Injection 실습 - beebox
* beebox xpath 구문
- $result = $xml -> xpath("/heroes/hero[login='" . $login . "' and password= '" . $password . "']");
* 공격 구문
- login - ' or 1=1 or ' / passwod - 공백
* 공격 구문 (자식노드 갯수 확인)
- xmli_1.php?login=neo'+and+count(../child::*)=6+or+'a'='b&password=&form=submit