[웹해킹] OAST / OOB(Out-of-Band) Testing

Introduction

웹 공격에는 다양한 취약점 탐지 방법이 연구되고 있다. 

클라우드 환경 웹 취약점 진단 중 Server-Side에서 다른 내부 서버로 요청이 필요할 때 파라미터를 변조할 경우 공격 성공 여부를 확인하는 방법을 찾던 중 OOB Testing에 대해 간략하게 정리한다.

OAST(Out-of-Band Application Security Testing)

OAST는 DAST(Dynamic Application Security Testing)을 보완하기 위한 모델이며, 외부 서버를 이용해서 보이지 않는 취약점을 찾을 수 있다.

진단자가 제어하는 인프라로 대상을 강제로 호출하여 웹 애플리케이션에서 악용 가능한 취약점을 찾는 방법이다. 동적 테스트 만으로 탐지하기 어려운 경우(blind, 비동기 버그 등)가 있는데 OAST로 동적 테스트를 강화하면 이러한 문제를 해결할 수 있다.

DAST

기존 웹 취약점 진단 시 Client - Server로 전달되는 페이로드를 추가/제거/변조/재전송하여 응답값을 분석하였다.

https://portswigger.net/burp/application-security-testing/oast

하지만 웹 애플리케이션이 취약함에도 응답을 반환하지 않도록 설정한 경우라면 공격자 입장에서는 공격의 성공 여부를 파악하기 어렵다.

OAST

공격자가 제어할 수 있는(=공격자 소유의) 인프라를 구축한 다음 응답을 대기하면서, 공격자 -> 대상 웹 애플리케이션으로의 페이로드 변조를 통해 공격자 인프라에서 응답을 분석한다.

https://portswigger.net/burp/application-security-testing/oast

 

Burp Suite Professional 라이센스를 사용하면, Burp Collaborator 기능을 통해 진단할 수 있다. Burp에서 HTTP, SMTP, DNS 등 프로토콜 요청이 발생했을 때 분석가능하도록 인프라를 제공해주며, 그 응답을 Burp에서 확인할 수 있도록 제공한다.

Useful Cases

OAST 진단이 유용한 경우를 살펴보면 다음과 같다.

  1. 네트워크 제한 우회: 공격 대상 시스템에 외부 시스템과의 직접적인 통신을 차단하는 네트워크 제한 또는 방화벽이 설정되어 있는 경우가 있다. OOB 테스트를 통해 공격자는 대체 통신 채널을 활용하여 이러한 제한을 우회할 수 있다.
  2. 탐지 규칙 회피: OOB 테스트는 침입 탐지 시스템(IDS) 또는 웹 애플리케이션 방화벽(WAF)과 같은 탐지 메커니즘을 우회할 수 있다. 공격자는 외부 시스템을 사용함으로써 대상 시스템 내에 있을 수 있는 경보나 알림을 트리거하지 않을 수 있다.
  3. 정보 수집: 공격자는 OOB 테스트를 통해 대상 시스템과 직접 상호 작용하지 않고도 대상 시스템에 대한 정보를 수집할 수 있습니다. 이는 특정 파일, 디렉터리 또는 내부 IP 주소의 존재를 식별하는 등 정찰시 활용할 수 있다.

OAST는 False Positive를 거의 생성하지 않으면서 DAST의 장점을 동시에 가지고 있다. 

공격자 인프라 구성하기

그럼 공격자 인프라는 어떻게 준비할까?

처음에는 클라우드 서비스(AWS)를 이용하여 인프라를 직접 구축하려했다.

1. EC2 인스턴스를 올린다.
2. Security Group을 설정하고 서비스에 사용할 포트를 모두 개방한다.
3. EC2에 접속해서 응답을 받을 서비스를 하나씩 구동해준다.
(and more...)

위와 같이 너무 많은 작업이 필요하기(돈도 들기) 때문에 지원하는 다른 도구를 찾게 되었다.

Interactsh

Interactsh(https://github.com/projectdiscovery/interactsh)는 앞서 설명한 진단 방법을 구현한 도구이다. OOB 통신 채널을 설정할 수 있는 유연하고 사용자 정의 가능한 플랫폼을 제공한다. 공격자는 이를 통해 정보를 수신하거나 작업을 실행하기 위한 엔드포인트 역할을 하는 임시 하위 도메인 또는 URL을 만들 수 있다.

설치

Go언어로 작성되었으므로 사전에 golang 설치가 필요하며, 다음 명령어로 설치한다.

GO111MODULE=on go get -v github.com/projectdiscovery/interactsh/cmd/interactsh-client

사용법

#interactsh-client -h
Usage:
  ./interactsh-client [flags]

Flags:
INPUT:
   -s, -server string  interactsh server(s) to use (default "oast.pro,oast.live,oast.site,oast.online,oast.fun,oast.me")

CONFIG:
   -config string                           flag configuration file (default "$HOME/.config/interactsh-client/config.yaml")
   -n, -number int                          number of interactsh payload to generate (default 1)
   -t, -token string                        authentication token to connect protected interactsh server
   -pi, -poll-interval int                  poll interval in seconds to pull interaction data (default 5)
   -nf, -no-http-fallback                   disable http fallback registration
   -cidl, -correlation-id-length int        length of the correlation id preamble (default 20)
   -cidn, -correlation-id-nonce-length int  length of the correlation id nonce (default 13)
   -sf, -session-file string                store/read from session file

FILTER:
   -m, -match string[]   match interaction based on the specified pattern
   -f, -filter string[]  filter interaction based on the specified pattern
   -dns-only             display only dns interaction in CLI output
   -http-only            display only http interaction in CLI output
   -smtp-only            display only smtp interactions in CLI output

UPDATE:
   -up, -update                 update interactsh-client to latest version
   -duc, -disable-update-check  disable automatic interactsh-client update check
   
OUTPUT:
   -o string  output file to write interaction data
   -json      write output in JSONL(ines) format
   -v         display verbose interaction

DEBUG:
   -version            show version of the project
   -health-check, -hc  run diagnostic check up

 

실행하게 되면 외부에서 접속 가능한 도메인을 할당해주며 OOB 테스팅을 시도할 payload에 도메인을 전달하면, 공격 성공 시 응답을 확인할 수 있다.

interactsh-client

    _       __                       __       __  
   (_)___  / /____  _________ ______/ /______/ /_ 
  / / __ \/ __/ _ \/ ___/ __ '/ ___/ __/ ___/ __ \
 / / / / / /_/  __/ /  / /_/ / /__/ /_(__  ) / / /
/_/_/ /_/\__/\___/_/   \__,_/\___/\__/____/_/ /_/ v0.0.5

        projectdiscovery.io

[INF] Listing 1 payload for OOB Testing
[INF] c23b2la0kl1krjcrdj10cndmnioyyyyyn.oast.pro

[c23b2la0kl1krjcrdj10cndmnioyyyyyn] Received DNS interaction (A) from 172.253.226.100 at 2021-26-26 12:26
[c23b2la0kl1krjcrdj10cndmnioyyyyyn] Received DNS interaction (AAAA) from 32.3.34.129 at 2021-26-26 12:26
[c23b2la0kl1krjcrdj10cndmnioyyyyyn] Received HTTP interaction from 43.22.22.50 at 2021-26-26 12:26
[c23b2la0kl1krjcrdj10cndmnioyyyyyn] Received DNS interaction (MX) from 43.3.192.3 at 2021-26-26 12:26
[c23b2la0kl1krjcrdj10cndmnioyyyyyn] Received DNS interaction (TXT) from 74.32.183.135 at 2021-26-26 12:26
[c23b2la0kl1krjcrdj10cndmnioyyyyyn] Received SMTP interaction from 32.85.166.50 at 2021-26-26 12:26

Interactsh는 DNS 기반 및 HTTP 기반 통신 채널을 포함한 다양한 기능을 제공한다. 공격자는 대상 애플리케이션 내에 Interactsh 엔드포인트 주소를 전달하도록 해서 서버와의 상호 작용을 통해 정보를 수집하거나 취약점을 탐지할 수 있다.

주의할 점으로는, 모의해킹을 수행하는 경우 사전에 협의된 대역 외부와의 통신이 발생하기 때문에 내부 자산정보가 유출될 수 있다. 또는 인터넷이 연결되지 않은 내부망 진단을 수행할 경우 클라우드 환경과의 통신이 불가능하다. 이 경우에는 진단자가 직접 별도의 환경으로 Self-Hosting된 인프라를 구축해야한다.

Conclusion

요약하면, OOB 테스트는 네트워크 제한을 우회하고, 탐지 메커니즘을 회피하고, 정보를 수집하고, 간접적인 취약점을 악용하는 도움이 되므로 취약점을 진단하는 유용하게 활용할 수 있다. interactsh 같은 도구는 OOB 통신 채널을 설정할 있는 편리한 플랫폼을 제공하여 공격자가 정보를 수집하거나 취약점을 효과적으로 익스플로잇할 있도록 도움을 준다.

References

https://portswigger.net/burp/application-security-testing/oast

 

Out-of-Band Application Security Testing (OAST) Software - PortSwigger

OAST security testing uses external servers to see otherwise invisible vulnerabilities. Find out more about our security testing solutions.

portswigger.net

https://github.com/topics/oob

 

GitHub: Let’s build from here

GitHub is where over 100 million developers shape the future of software, together. Contribute to the open source community, manage your Git repositories, review code like a pro, track bugs and fea...

github.com

 

ChatGPT

반응형

'Security > WEB' 카테고리의 다른 글

[웹 크롤링] cloudflare 차단 우회  (1) 2023.12.27
[PKI] 인증서 관리 규격  (1) 2022.12.03
제 3자 쿠키 허용, 왜 위험할까?  (0) 2022.10.30
[WEB] Client Side Storage  (0) 2022.10.09
2FA 인증 및 우회 방법 정리  (0) 2022.08.31