CI for Automatic recon
Hi hackers and bugbounty hunters ๐
CI/CD is a key topic in DevOps, DevSecOps. Iโm also working on DevSecOps, so Iโve been thinking about it a lot and testing it. Meanwhile, I thought it would be okay to use CI concept in Recon. CI/CD๋ DevOps, DevSecOps์์ ๊ฐ์ฅ ํต์ฌ์ ์ธ ์ฃผ์ ๊ฐ ๋๋ ๋ด์ฉ์ ๋๋ค. ์ ๋ํ ์ผ์ ์ผ๋ก DevSecOps์ ๋ํ ๋ถ๋ถ๋ ํ๊ณ ์๊ธฐ ๋๋ฌธ์ ์์ฃผ ๊ณ ๋ฏผํ๊ณ , ํ ์คํธํด๋ณด๊ณ ์๋๋ฐ์. ๊ทธ๋ฌ๋ ์ค Recon์ CI ๊ฐ๋ ์ ์ฌ์ฉํด๋ด๋ ๊ด์ฐฎ์ ๊ฒ ๊ฐ์ ์๊ฐ์ด ๋ค์์ต๋๋ค.
Todays, CI for Recon! ๊ทธ๋์ ์ค๋์ Recon์์ CI๋ฅผ ์ ์ฉํ๋ ์ด์ผ๊ธฐ์ ๋ํด ๊ณต์ ๋๋ฆด๊น ํฉ๋๋ค.
What is CI(Continuous Integration)?
It literally means continuous integration. This refers to an automated process that periodically builds and integrates source code into testing, repo, etc. according to specific events, such as code changes and periodic settings. ์ด๋ฆ ๊ทธ๋๋ก ์ง์์ ์ธ ํตํฉ์ ์๋ฏธํฉ๋๋ค. ์ฝ๋ ๋ณ๊ฒฝ, ์ฃผ๊ธฐ์ ์ธ ์ค์ ๋ฑ ํน์ ์ด๋ฒคํธ์ ๋ฐ๋ผ ์์ค์ฝ๋๋ฅผ ์ฃผ๊ธฐ์ ์ผ๋ก ๋น๋ํ๊ณ ํ ์คํธ, Repo(git ๋ฑ)์ ํตํฉํ๋ ์๋ํ ํ๋ก์ธ์ค๋ฅผ ์๋ฏธํฉ๋๋ค.
Why CI?
Personally for BugBounty, make and use a lot of tools, and we accumulate data. In my case, I wanted to combine multiple devices and the results of the testing server and MacBookโs different results.
So I used CI concept for continuous bugbounty data integration. ๊ฐ์ธ์ ์ผ๋ก ๋ฒ๊ทธ๋ฐ์ดํฐ๋ฅผ ์ํด์(์์ฃผํ์ง๋ ์์ง๋ง) ์ฌ๋ฌ๊ฐ์ง ๋๊ตฌ๋ฅผ ๋ง๋ค์ด์ ์ฌ์ฉํ๊ณ , ๋ฐ์ดํฐ๋ฅผ ๋์ ํ๋๋ฐ์. ์ ์ ๊ฒฝ์ฐ ์ฌ๋ฌ ๋๋ฐ์ด์ค๋ฅผ ์ฌ์ฉํ๊ณ ํ ์คํ ์๋ฒ์ ๊ฒฐ๊ณผ์ ๋งฅ๋ถ์ ๋ค๋ฅธ ๊ฒฐ๊ณผ๊ฐ ์์ด์ ์ด๋ฅผ ํตํฉํ๊ณ ์ถ์ ์๊ฐ์ ์์์ต๋๋ค.
๊ทธ๋์ ์ง์์ ์ธ ๋ฒ๊ทธ๋ฐ์ดํฐ ๋ฐ์ดํฐ ํตํฉ์ ์ํด์ CI ๊ฐ๋ ์ ๋ถ์ฌ๋ดค์ต๋๋ค.
How to?
When triggered largely by a specific event(add new target, and weekly?), it has a structure that uses the existing Recon tool to analyze, add the results in github and tell me with Slack.
์ฐ์ ์ ์ ๋์ฆ๋ ํ์คํ๊ณ , ๊ธฐ์กด์ ์ฌ์ฉํ๋ ๋๊ตฌ์ pipeline์ CI/CD ๋๊ตฌ์ ์ด์ํ๊ธฐ ์์ํ์ต๋๋ค. ๊ฐ์ฅ ์ปค๋ฎค๋ํฐ๊ฐ ํ๋ฐํ๊ณ ๋ง์ด ์ฌ์ฉ๋๋ Jenkins๋ฅผ ํํ๊ณ ์ ํฌ recon ๋๊ตฌ์ slack๊น์ง ์ด์ด์ง๋ ๊ทธ๋ฆผ์ ๊ทธ๋ ธ์ต๋๋ค.
Jenkins + My private app + Slack notify
ํฌ๊ฒ ํน์ ์ด๋ฒคํธ์์ ํธ๋ฆฌ๊ฑฐ๊ฐ ๋๋ฉด, ๊ธฐ์กด์ ์ฌ์ฉํ๋ Recon ๋๊ตฌ๋ฅผ ์ด์ฉํด์ ๋ถ์ํ๊ณ , ๊ฒฐ๊ณผ๋ฅผ github์ ๋ฐ์ ๋ฐ slack์ผ๋ก ์๋ ค์ฃผ๋ ๊ตฌ์กฐ๋ฅผ ๊ฐ์ง๋๋ค.
Make item template
First of all, we will create one item for each Recon, so make one item to use as a template. ์ฐ์ ๋งค๋ฒ Recon ๋ง๋ค ํ๋์ item์ ๋ง๋ค์ด์ค๊ฑฐ๋ผ Template๋ก ์ฌ์ฉํ item์ ํ๋ ๋ง๋ค์ด์ค๋๋ค.
Connect git repo
Connect to Git repo for integration of Recon results. Recon ๊ฒฐ๊ณผ์ ํตํฉ์ ์ํด์ Git repo๋ฅผ ์ฐ๊ฒฐํด์ค๋๋ค.
Execute Shell
Then run the Recon tool. I think you can put the shell script according to the tool you are using. At this time, the important thing is to use the git publisher to reflect the results to git, but it is said that the -am
option should be given, such as git commit -am 'msg'
.
๊ทธ๋ค์ Recon ๋๊ตฌ๋ฅผ ์คํํด์ค๋๋ค. ์ฌ๋ฌ๋ถ๋ค์ด ์ฌ์ฉํ์๋ ๋๊ตฌ์ ๋ง๊ฒ Shell script๋ฅผ ๋ฃ์ด์ฃผ์๋ฉด ๋ ๊ฒ ๊ฐ์ต๋๋ค. ์ด ๋ ์ค์ํ๊ฑด ๊ฒฐ๊ณผ๋ฅผ git์ ๋ฐ์ํ๊ธฐ ์ํด์ git publisher๋ฅผ ์ฌ์ฉํ๋๋ฐ git commit -am 'msg'
๊ฐ์ด -am
์ต์
์ ์ค์ผํ๋ค๊ณ ํ๋ค์.
Set Git Publisher and Slack Notifications in Jenkins
Finally, the result is reflected on github through the Git publisher, and a plugin is applied to notify with Slack. ๋ง์ง๋ง์ผ๋ก Git publisher๋ฅผ ํตํด ๊ฒฐ๊ณผ๋ฅผ github์ ๋ฐ์ํ๊ณ , Slack์ผ๋ก notify ์ค ์ ์๋๋ก ํ๋ฌ๊ทธ์ธ์ ์ ์ฉํด์ค๋๋ค.
Running and Result
Run
Finish notify
Result
Conclusion
Honestly, it was a project I did for fun, but it was nice that the result was more satisfying than I thought. I think continually integrating analytical data can be of great help in finding better results.
์์งํ ์ฌ๋ฏธ์ผ์ ํด๋ณธ ํ๋ก์ ํธ์ธ๋ฐ, ์๊ฐ๋ณด๋ค ๊ฒฐ๊ณผ๊ฐ ๋ง์กฑ์ค๋ฌ์์ ์ข์์ต๋๋ค. ์ง์์ ์ผ๋ก ๋ถ์ ๋ฐ์ดํฐ๋ฅผ ํตํฉ์ํจ๋ค๋๊ฒ, ์กฐ๊ธ ๋ ๋์ ๊ฒฐ๊ณผ๋ฅผ ์ฐพ๋๋ฐ ํฐ ๋์์ด ๋ ์ ์๋ค๊ณ ์๊ฐํฉ๋๋ค.
Later 1dayโฆ
code
if [ ! -d bugbounty/$TARGET; ]; then
mkdir bugbounty/$TARGET;
fi
cd bugbounty/$TARGET;
export PATH=$PATH:/var/lib/jenkins/go/bin;
~/go/bin/D.E.V.I init;
touch s_target.txt
touch w_target.txt
if [ -n $STARGET ] ; then
echo "$STARGET" > s_target.txt
fi
if [ -n $WTARGET ] ; then
echo "$WTARGET" > w_target.txt
fi
~/go/bin/D.E.V.I recon;
git add --all;
git commit -am "update";
Later 2weekโฆ
And two weeks later, I changed the structure to Pipeline using Jenkinsfile. (Because itโs easier to control the entire flow with shell pipeline and groovy script than logic of go app)