Make cloud base ZAP Scanning Environment Using github-action
Hi hackers and bugbounty hunters :D Today, I talk about building a github-action-based ZAP scanning environment. As you know, there is no time limit for public repo, so you can configure a cloud-based vulnerability scanner for free ๐
์ ๋ ๋ณดํต ๊ฐ์ธ์ ์ธ ์์ ์ ํ์๋ฒ์ ZAP์ ์ค์บ๋๋ก ๋ง์ด ์ฌ์ฉํฉ๋๋ค. ๋ค๋ง ZAP์ ์ค์บ๋์ด ๋ง์์ง๋ ๊ฒฝ์ฐ ์๋ฒ ํผ์จ๊ฐ ๊ต์ฅํ ํ๋ค์ดํ๋๊ฑธ ๋๋ผ๊ณ ์์ด, ๊ฐ๋ฅํ ZAP ์ค์บ๋๋ ํด๋ผ์ฐ๋ ํ๊ฒฝ์ผ๋ก ๋๊ฒจ๋ณด๋ ค๊ณ ํ์์ต๋๋ค. (์ด๋ ๋ฒ์จ 2๋ ์ ๋ถํฐ ๋น์ฉ์ ์ต์ํํ๋ ๋ฐฉ๋ฒ๋ค์ ์ฐพ๊ณ ์์๋ค์. ๋ํ์ ์ผ๋ก herokuโฆ)
์๋ฌดํผ ์ต๊ทผ github action ์ชฝ์ผ๋ก ์์ ์ ๋ง์ด ํ๊ณ ์๋๋ฐ, ๋ณด๋ค๋ณด๋ ์ทจ์ฝ์ ์ค์บ๋ ์์ ์ CI/CD DAST์ ๋ชฉ์ ์ด ์๋, ๋จ์ํ ๋งค๋ด์ผ ์ค์บ๋๋ก๋ ์ธ ์ ์์ ๊ฒ ๊ฐ์์ ๊ธ๋ก ์์ฑํด๋ด ๋๋ค.
What is Github Actions(workflow)
Github action is automate, customize, and execute software development workflows right in repository. Can discover, create, and share actions to perform any job youโd like, including CI/CD, and combine actions in a completely customized workflow.
Github action์ github์์ ์ ๊ณตํ๋ CI/CD๋ฅผ ์ํ ์๋ํ ํ๊ฒฝ์ ๋๋ค. workflow ํ์ผ๋ก ์ํํ ์ก์ ๊ณผ ์กฐ๊ฑด์ ๋ช ์ํ๋ฉด ํด๋น ์กฐ๊ฑด์ด ํธ๋ฆฌ๊ฑฐ๋ ๋ ์๋ํ ์ก์ (๋น๋/๋ฐฐํฌ/ํ ์คํ ๋ฑ๋ฑ)์ด ์ํ๋ฉ๋๋ค.
ZAP workflow for CI/CD DAST Scanning
ZAP, the representative of DAST, is also adding and managing github action. Typically, it is divided into baseline scan and fullscan.
DAST์ ๋ํ์ฃผ์์ธ ZAP์ github action ๋ํ ์ถ๊ฐํ๊ณ ๊ด๋ฆฌ์ค์ ๋๋ค. ๋ํ์ ์ผ๋ก baseline scan๊ณผ fullscan์ผ๋ก ๋๋์ด์ ธ ์์ต๋๋ค.
How? manually scanning
Github action is designed to work only under certain conditions, such as push, pull request, and cron. However, if using workflow_dispatch, can manual workflow triggers.
๊ธฐ๋ณธ์ ์ผ๋ก github action์ push, pull request ๋ฐ cron ๋ฑ ํน์ ์กฐ๊ฑด์์๋ง ๋์ํ๋๋ก ์ค๊ณ๋์ด ์์ต๋๋ค. ๊ทธ๋ ์ง๋ง workflow_dispatch๋ผ๋๊ฑธ ์ง์ํด์ฃผ๋ฉด์, ๋งค๋ด์ผํ workflow ํธ๋ฆฌ๊ฑฐ๋ ๊ฐ๋ฅํฉ๋๋ค.
https://www.hahwul.com/2020/10/18/how-to-trigger-github-action-manually
Test ZAP Manual Scanning in git-action
My testing git repository
Make workflow file
Workflow file(.github/workflow/zap-scan.yml
)
name: ZAP-SCAN
on:
schedule:
- cron: '0 2 * * sun' #
workflow_dispatch:
inputs:
target:
description: 'target URL'
required: true
default: ''
jobs:
zap_scan:
runs-on: ubuntu-latest
name: Scan the webapplication
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: main
- name: ZAP Scan
uses: zaproxy/action-baseline@v0.4.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
docker_name: 'owasp/zap2docker-stable'
target: "${{ github.event.inputs.target }}"
rules_file_name: '.zap/rules.tsv'
cmd_options: '-a'
- workflow_dispatch: for manually
- workflow_dispatch/inputs: value and parameter
- jobs/zap_scan: zap scanning
Run git-action with parameter
Your repo
> Actions
> Your action name
> Run workflow
> Input parameter and run workflow
Running..
Finish
When finished, the results are registered as an issue.
์๋ฃ๋๋ฉด ๊ฒฐ๊ณผ๋ issue๋ก ๋ฑ๋ก๋ฉ๋๋ค.