Find testing point using tomnomnom’s tool, for bugbounty!

I recently watched a video that looked for inspection points in a unique way from Stok’s video(interviewed tomnomnom) So, today, I’m going to introduce you to some of the tools and techniques introduced in that video. 최근에 Stok 영상 중 tomnomnom 를 인터뷰한게 있어서 보던 중 특이한 방식으로 점검 포인트를 찾는 영상을 보게되었습니다. 그래서, 오늘은 해당 영상에서 소개된 툴과 기법들 중 일부를 가볍게 소개하려고 합니다. (저도 정리가 필요해서리..)

꼭 영상 한번 보세요! 최고입니다!!(Please watch the video! It’s the best!!!!)

Pre-install

First of all, we’re going to use four tools that tomnomnom created. Please install it. 우선 tomnomnom 가 만든 4가지 도구를 사용할겁니다. 설치해주세요.

assetfinder , httprobe , meg , gf

install script

go get -u github.com/tomnomnom/assetfinder
go get -u github.com/tomnomnom/httprobe
go get -u github.com/tomnomnom/meg
go get -u github.com/tomnomnom/gf
cp -r ~/go/src/github.com/tomnomnom/gf/examples ~/.gf

set command alias

vim {your-rc} # vimrc, zshrc, etc...

alias assetfinder='/Users/hahwul/go/bin/assetfinder'
alias httprobe='/Users/hahwul/go/bin/httprobe'
alias meg='/Users/hahwul/go/bin/meg'
alias gf='/Users/hahwul/go/bin/gf'

Find subdomain and asset

Subdomain enum actually has a lot of tools. Although you can use the assetfinder를 created by tomnomnom, it is important to use as many tools as you can, such as Amass and Subfinder, to get a lot of subdomain lists. Subdomain enum은 사실 도구가 굉장히 많습니다. tomnomnom 가 만든 assetfinder를 사용해도 좋지만 이와 함께 Amass와 Subfinder등 최대한 도구를 많이 사용해서 서브 도메인 리스트를 많이 확보하는게 중요합니다.

assetfinder -subs-only {target-domain} >> domains

subfinder -d {target-domain} >> domains

이런식으로 파일 하나에 도메인을 다 밀어넣은 후 중복제거만 해주면 됩니다.

Make HTTP/HTTPS URLS

this time we’re going to analyze the http response, so we’ll sort it into the http/https domain. The http/https url list can be obtained using the httporbe and tee commands as follows: 보통은 식별한 서브도메인 기준으로 Takeover 체크 후 스캔을 돌리던 개별적으로 보던 하는데요, 이번엔 http response를 분석할 것이기 때문에 http/https 도메인으로 정리해줍니다. httporbe와 tee 명령을 이용해 아래와 같이 http/https url 리스트를 확보할 수 있습니다. httprobe is making http/https list

cat domains | httprobe | tee hosts

In my case… i run my private tools that built to identify and use that data as back data. 저의 경우는.. 이 과정까지는 따로 구축한 도구를 돌려 식별하고 있어서 해당 데이터를 백 데이터로 사용합니다.

Meg!

Get http response headers and body, Meg is a tool that stores the http response header and body as a file. Meg는 http response header와 body를 파일로 저장하는 도구입니다.

meg -d 1000 -v /

Once completed, multiple files will be created for each domain, as shown below. Inside the file, a http response (header + body) is stored. 작업이 완료되면 아래와 같이 도메인별로 여러개의 파일이 생기게 됩니다. 해당 파일 내부에는 http response(header + body)가 저장됩니다.

index 파일을 보면 파일과 url, response code를 확인할 수 있어요
내부에는 curl 의 결과가 들어있습니다.

Find point with gf

gf is wrapper around grep, to help you grep for things. gf는 개량형 grep이라고 보시면 좋습니다. grep으로 직접 찾아도 되지만, 미리 패턴을 정의해놓고 쓰기에는 gf가 더 편합니다.

기본적으로 아래 리스트를 지원합니다.

gf -list
aws-keys
base64
cors
debug-pages
firebase
fw
go-functions
http-auth
ip
json-sec
meg-headers
php-curl
php-errors
php-serialized
php-sinks
php-sources
s3-buckets
sec
servers
strings
takeovers
upload-fields
urls

grap flag and regular expression are stored json file 내용을 보면.. grep flag와 정규식이 저장되어 있습니다.

cat ~/.gf/aws-keys.json

{
    "flags": "-HanrE",
    "pattern": "([^A-Z0-9]|^)(AKIA|A3T|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{12,}"
}

This makes it easy to place grep run the current directory. This way, I can see the CORS setting at once. 이를 통해 현재 디렉토리 내부에서 grep을 쉽게 걸 수 있습니다. 이런식으로 cors 설정을 한번에 보거나..

gfgf cors
./global-esports-cms.pubg.com/85085c2e01f50f05ce006627b0aa0963e9413625:14:< Access-Control-Allow-Origin: *
./global-esports-cms.pubg.com/42612c024c5d21ec68c677eaa3bc85e1d6b2565f:13:< Access-Control-Allow-Origin: *

Can also check where base64 data is used. base64 데이터가 사용되는 부분을 체크할 수도 있습니다.

gfgf base64
./forums.pubg.com/18f5e3af7e0599284b89bc69d7bb095cfbc65b42:13:-aHR0cHM6Ly9mb3J1bXMucHViZy5jb20vcmVnaXN0ZXIvP2RvPW9wSWZyYW1lUmVmbG93UHJvY2Vzcw==
-aHR0cHM6Ly9mb3J1bXMucHViZy5jb20v
./forums.pubg.com/681c348f74161e12908368f601f4d3c785085c45:18:-aHR0cHM6Ly9mb3J1bXMucHViZy5jb20vcmVnaXN0ZXIvP2RvPW9wSWZyYW1lUmVmbG93UHJvY2Vzcw==
-aHR0cHM6Ly9mb3J1bXMucHViZy5jb20v

The defined regular expression is useful, so if you try it a few times, you’ll get some testing points. In addition, there are patterns that can only occur in certain companies, so you can test them with a regular expression. 정의된 정규식이 쓸만한편이라 몇번 해보시면 테스팅 포인트가 좀 잡힙니다. 추가로.. 특정 기업에서만 발생할 수 있는 패턴들도 있으니 적절하게 정규식 추가해서 테스트해보시면 좋습니다.

Now start happy hacking with the identified data!

https://i.giphy.com/3oz8xCxj4400yvfgDm.gif