Testing for SSI Injection (OWASP-DV-009) 번역

2016. 11. 21. 12:25·프로젝트 관련 조사/모의 해킹
반응형

[출처] Testing for SSI Injection (OWASP-DV-009) 번역|작성자 ezno

http://blog.naver.com/PostView.nhn?blogId=ezno&logNo=130142796061&parentCategoryNo=&categoryNo=&viewDate=&isShowPopularPosts=false&from=postView





원문 https://www.owasp.org/index.php/Testing_for_SSI_Injection 

번역입니다.


Testing for SSI Injection (OWASP-DV-009)

(Redirected from Testing for SSI Injection)

OWASP Testing Guide v3 Table of Contents

 

Brief Summary (생략)

Web servers usually give developers the ability to add small pieces of dynamic code inside static HTML pages, without having to deal with full-fledged server-side or client-side languages. This feature is incarnated by the Server-Side Includes (SSI). In SSI injection testing, we test if it is possible to inject into the application data that will be interpreted by SSI mechanisms. A successful exploitation of this vulnerability allows an attacker to inject code into HTML pages or even perform remote code execution.

 

Description of the Issue

Server-Side Inlcudes는 웹서버가 사용자에게 페이지를 제공하기 전에 구문을 해석하도록 지시한다. Server-Side Inlcudes는 CGI프로그램을 작성하거나 혹은 server side 스크립트를 사용하는 내장된 간단한 언어들로, 오직 간단한 task들을 실행할 때 만 필요로 한다.

공통 SSI 구현은 외부의 파일들을 include 할 수 있는 명령어들을 제공하며, 웹 서버의 CGI 환경 변수를 설정하고 출력할 수 있고, 또한 외부의 CGI 스크립트 혹은 시스템 명령어들을 실행 할 수 있다.

 

SSI 지시를 static HTML 문서에 넣는 것은 다음과 같은 코드를 쓰는 것 만큼 간단하다 

<!--#echo var="DATE_LOCAL" -->

현재의 시간을 출력

<!--#include virtual="/cgi-bin/counter.pl" -->

CGI 스크립트의 결과를 포함

<!--#include virtual="/footer.html" -->

파일 포함

<!--#exec cmd="ls" -->

시스템 명령어의 결과를 포함

 

만약 web server가 SSI 지원이 가능하면, 서버는 이러한 명령들을 실행 시킬 것이다. 기본 설정으로, 일반적으로, 대부분의 웹 서버들은 이러한 exec 명령들이 system 명령어를 실행시키도록 허용하지 않는다.

모든 bad 입력 값 검증(bad input validation) 상황처럼, 문제는 웹 애플리케이션의 사용자가 애플리케이션 혹은 웹 서버가 예측하지 못한 방식으로 데이터들을 제공하도록 허용할 때 발생한다.

SSI injection 때문에, 공격자가 애플리케이션에(혹은 서버에 직접적으로) 삽입된 동적으로 페이지를 생성 수 있는 input을 만들 수 있다면, 한 개 혹은 그 이상의 SSI 지시들을 parse 시킬 수 있다.

전통적인 스크립트 언어 injection 취약점과 매우 유사하다. 한가지 나은 점은 웹서버가 SSI를 허용하도록 설정해야 한다는 것이다.반면에, SSI Injection 취약점은 실행시키기 좀 더 간단하다. 왜냐하면 SSI 지시어들은 이해하기 쉽고, 파일의 내용을 출력하고 시스템 명령어를 실행 시킬 수 있을 만큼 강력하기 때문이다.

 

Black Box testing

finding if the web server actually supports SSI directives.

웹서버가 SSI 지시어들을 허용하는지 대상 웹사이트들의 컨텐츠를 보면서 확인한다.

.shtml 파일이 있다면, SSI를 허용할 가능성이 높다.

아래와 같은 입력 값들이 유효하며, 입력값이 저장된 것을 확인한다.

< ! # = / . " - > and [a-zA-Z0-9]

To test if validation is insufficient, we can input, for example, a string like the following in an input form

다음과 같은 문자열을 input form에 입력하여 확인을 해본다.

<!--#include virtual="/etc/passwd" -->

이것은 XSS 취약점을 점검하는 것과 유사하다.

<script>alert("XSS")</script>

만약 애플리케이션이 취약하다면, 지시어들은 삽입이 되고 다음 페이지가 제공될 때 서버에 의해서 해석될 것이다. 따라서, Unix의password 파일이 컨텐츠에 포함될 것이다.

만약 웹 애플리케이션이 데이터들을 동적으로 페이지에게 생성하도록 한다면, 삽입은 HTTP 헤더에서 또한 수행할 수 있다.

GET / HTTP/1.0

Referer: <!--#exec cmd="/bin/ps ax"-->

User-Agent: <!--#include virtual="/proc/version"-->

Gray Box testing and example  (번역 생략)

If we have access to the application source code, we can quite easily find out:

If SSI directives are used. If they are, then the web server is going to have SSI support enabled, making SSI injection at least a potential issue to investigate.

Where user input, cookie content and HTTP headers are handled. The complete list of input vectors is then quickly determined.

How the input is handled, what kind of filtering is performed, what characters the application is not letting through, and how many types of encoding are taken into account.

Performing these steps is mostly a matter of using grep to find the right keywords inside the source code (SSI directives, CGI environment variables, variables assignment involving user input, filtering functions and so on).


References

Whitepapers

Apache Tutorial: "Introduction to Server Side Includes" - http://httpd.apache.org/docs/1.3/howto/ssi.html

Apache: "Module mod_include" - http://httpd.apache.org/docs/1.3/mod/mod_include.html

Apache: "Security Tips for Server Configuration" - http://httpd.apache.org/docs/1.3/misc/security_tips.html#ssi

Header Based Exploitation - http://www.cgisecurity.net/papers/header-based-exploitation.txt

SSI Injection instead of JavaScript Malware - http://jeremiahgrossman.blogspot.com/2006/08/ssi-injection-instead-of-javascript.html

Tools

Web Proxy Burp Suite - http://portswigger.net

Paros - http://www.parosproxy.org/index.shtml

WebScarab

String searcher: grep - http://www.gnu.org/software/grep, your favorite text editor

[출처] Testing for SSI Injection (OWASP-DV-009) 번역|작성자 ezno


반응형
저작자표시 (새창열림)

'프로젝트 관련 조사 > 모의 해킹' 카테고리의 다른 글

무선랜 - Evil Twin ( 공격 및 탐지 툴)  (0) 2017.05.30
[WASC-36] SSI Injection 번역  (0) 2016.11.21
Open Redirect Cheat sheet  (0) 2016.11.16
Advanced SQL Injection 공격사례 정리  (1) 2016.11.01
SQL Injection 공격시 공백 문자 필터링 우회 문자들  (0) 2016.11.01
'프로젝트 관련 조사/모의 해킹' 카테고리의 다른 글
  • 무선랜 - Evil Twin ( 공격 및 탐지 툴)
  • [WASC-36] SSI Injection 번역
  • Open Redirect Cheat sheet
  • Advanced SQL Injection 공격사례 정리
호레
호레
창업 / IT / 육아 / 일상 / 여행
    반응형
  • 호레
    Unique Life
    호레
  • 전체
    오늘
    어제
    • 분류 전체보기
      • 법률
        • 기본
        • 개인정보보호법
        • 정보통신망법
        • 전자금융거래법
        • 전자금융감독규정
        • 신용정보법
        • 온라인투자연계금융업법
      • 창업
        • 외식업 관련
        • 임대업 관련
        • 유통업 관련
        • 세무 관련
        • 마케팅 관련
        • 기타 지식
        • 트렌드
        • Youtube
      • IT기술 관련
        • 모바일
        • 윈도우
        • 리눅스
        • MAC OS
        • 네트워크
        • 빅데이터 관련
        • A.I 인공지능
        • 파이썬_루비 등 언어
        • 쿠버네티스
        • 기타 기술
      • 퍼블릭 클라우드 관련
        • Azure
        • GCP
        • AWS
      • 정보보안 관련
        • QRadar
        • Splunk
        • System
        • Web
      • 기타
        • 세상 모든 정보
        • 서적
      • 게임 관련
        • 유니티
      • 부동산
      • 맛집 찾기
        • 강남역
        • 양재역
        • 판교역
        • ★★★★★
        • ★★★★
        • ★★★
        • ★★
        • ★
      • 결혼_육아 생활
        • 리얼후기
        • 일상
        • 육아
        • 사랑
        • Food
      • 영어
        • 스피킹
        • 문법
        • 팝송
        • 영화
      • K-컨텐츠
        • 드라마
        • 영화
        • 예능
      • 독서
      • 프로젝트 관련 조사
        • 시스템 구축
        • 로그 관련
        • 웹
        • APT
        • 모의 해킹
        • DB
        • 허니팟
        • 수리카타
        • 알고리즘
        • FDS
      • 기업별 구내 식당 평가
        • 한국관광공사
        • KT telecop
        • KT M&S
        • KT powertel
        • KT cs 연수원
        • 진에어
      • 대학 생활
        • 위드윈연구소
        • 진로 고민
        • 채용정보
        • 자동차
        • 주식
        • 악성코드
        • 게임 보안
      • 쉐어하우스
  • 블로그 메뉴

    • 홈
    • 게임 관련
    • IT 기술 관련
    • 태그
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    복리후생
    AWS
    점심
    이재곧죽습니다
    마케팅
    판교맛집
    수제버거존맛
    수제버거
    보안가이드
    런치
    판교
    쥬쥬랜드
    돈까스
    판교역
    맛집
    유니티
    대통령
    무역전쟁
    수제버거맛집
    상호관세
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.0
호레
Testing for SSI Injection (OWASP-DV-009) 번역
상단으로

티스토리툴바