Scanning multiple targets in ZAP

저는 ZAP과 Burp pro 모두를 사용하고 있습니다. 각각 도구가 가진 특성과 라이선스적인 문제로 인해서 같이 사용하고 있는데, 사실 누가 좋다고 우위를 가리기는 어렵습니다. (워낙 특성도 다르고, 각 도구가 바라보는 목표도 분명히 달라요)

그리고 종종 Burp/ZAP 두 도구의 Scanning 기능을 사용하곤 하는데, ZAP쪽에 약간 불편한점이 있습니다. 오늘은 이 불편한 부분이 뭔지, 어떻게 해결했는지, 더 좋은 해결방안을 위한 개발중인 도구에 대해 이야기하려고 합니다.

I use both ZAP and Burp pro. Often I use the Scanning function of Burp/ZAP, but there is a slight inconvenience on the ZAP side. Today I’m going to talk about what this discomfort is, how it’s solved, and the tools under development for a better solution.

What’s problem?

ZAP의 스캐닝은 Burp와 다르게 단일 스캐닝만 지원합니다. 다수 대상으로 돌리기에는 좀 불편하긴하죠. ZAP is only single URL scanning is supported..

Therefore, there are many inconveniences to scan multiple URLs.

What is ZAP API

ZAP은 REST API를 제공하고 있고, 제가 아는 선에서는 가장 많은 것을 컨트롤 할 수 있게 도와줍니다. 그래서 ZAP API와 curl, xargs를 이용해서 쉽게 다수의 URL에 대해 스캔 요청을 할 수 있습니다.

ZAP supports the most detailed APIs among scanners I know. Of course there are plenty of GraphQL for Burp Enterprise. Still, ZAP is the most detailed.

So I made a simple command line that can scan multiple URLs using API.

Spidering multiple targets

cat hosts | xargs -I % curl -i -k http://localhost:8090/JSON/spider/action/scan/\?url\=%\&maxChildren\=\&recurse\=\&contextName\=\&subtreeOnly\=

Active Scanning multiple targets

cat hosts | xargs -I % curl -i -k http://localhost:8090/JSON/ascan/action/scan/\?url\=%\&maxChildren\=\&recurse\=\&contextName\=\&subtreeOnly\=

Testing..

Running multiple Active scanning with curl

Added scans

But you always have to be careful of overload.

Isn’t there a better way?

매번 이렇게 쓰는건 귀찮습니다. bash/zsh profile이나 pet snippet 등으로 사용하면 편하긴 하겠지만, 저는 조금 더 사용성에 대한 니즈가 있었습니다. 바로 N(ZAP) by N(Target) 스캐닝인데요. 이걸 해보려고 간단한 도구를 만들고 있습니다. 아마.. 글이 올라가고 조금 지나면 기본적인 기능을 될 것 같네요.

It’s uncomfortable to call curl every time. So I was trying to create a zsh profile. but and I thought of a simple tool. and making it now.

https://github.com/hahwul/mzap

e.g

mzap spider --urls hosts.txt --apis http://localhost:8090,http://192.168.0.4:8081

carbon (1)

아무튼, 관심있으시면 Issue/PR 주세요 :D

I want to code the logic above, and support N*N scanning. (Multiple ZAPs, Multiple Targets) If you are interested, please send us your PR anytime.