Hack The Boxでは、プラットフォームの中心となる「マシン」のほかに、「チャレンジ」と呼ばれる小規模なタスクにも取り組めます。チャレンジは通常、やや短時間で完了でき、取得するフラグも1つだけですが、多くの場合、ダウンロード可能なリソースファイル一式が用意されています。たとえば、Wiresharkで解析するpcapファイルや、対象アプリケーションのソースコード一式などです。ソースコードがあれば、アプリケーションの構造やコードを分析できます。まさにSnykが役立つ場面です。
1$ snyk code test23Testing 4/home/mconradt/Documents/HTB/Challenges/web_blinkerfluids/challenge ...56 ✗ [Medium] Cross-Site Request Forgery (CSRF) 7 Path: index.js, line 28 Info: Consider using csurf middleware for your Express app to protect against CSRF attacks.910 ✗ [Medium] Information Exposure 11 Path: index.js, line 212 Info: Disable X-Powered-By header for your Express app (consider using Helmet middleware), because it exposes information about the used framework to potential attackers. 1314 ✗ [Medium] Allocation of Resources Without Limits or Throttling 15 Path: routes/index.js, line 916 Info: This endpoint handler performs a file system operation and does17not use a rate-limiting mechanism. It may enable the attackers to perform Denial-of-service attacks. Consider using a rate-limiting middleware such as express-limit. 1819 ✗ [High] Cross-site Scripting (XSS) 20 Path: static/js/main.js, line 2021 Info: Unsanitized input from data from a remote resource flows into append, where it is used to dynamically construct the HTML page on client side. This may result in a DOM Based Cross-Site Scripting attack (DOMXSS). 2223✔ Test completed2425Organization: e-corp-demo 26Test type: Static code analysis 27Project path:28/home/mconradt/Documents/HTB/Challenges/web_blinkerfluids/challenge 2930Summary:3132 4 total Code issues: | 1 High | 3 Medium
1$ snyk test23Testing4/home/mconradt/Documents/HTB/Challenges/web_blinkerfluids/challenge...56Tested 286 dependencies for known issues, found 4 issues, 11 vulnerable paths. 78Issues to fix by upgrading: 910 Upgrade md-to-pdf@4.1.0 to md-to-pdf@5.0.2 to fix11 ✗ Regular Expression Denial of Service (ReDoS) [Medium Severity] [https://security.snyk.io/vuln/SNYK-JS-MARKED-2342073] in marked@2.1.3 introduced by md-to-pdf@4.1.0 > marked@2.1.3 12 ✗ Regular Expression Denial of Service (ReDoS) [Medium Severity] [https://security.snyk.io/vuln/SNYK-JS-MARKED-2342082] in marked@2.1.3 introduced by md-to-pdf@4.1.0 > marked@2.1.3 13 ✗ Remote Code Execution (RCE) [Critical Severity]14[https://security.snyk.io/vuln/SNYK-JS-MDTOPDF-1657880] in md-to pdf@4.1.0 15 introduced by md-to-pdf@4.1.01617Issues with no direct upgrade or patch: 18 ✗ Regular Expression Denial of Service (ReDoS) [High Severity] [https://security.snyk.io/vuln/SNYK-JS-ANSIREGEX-1583908] in ansi regex@2.1.1 19 introduced by md-to-pdf@4.1.0 > listr@0.14.3 > listr-update renderer@0.5.0 > strip-ansi@3.0.1 > ansi-regex@2.1.1 and 7 other path(s) This issue was fixed in versions: 3.0.1, 4.1.1, 5.0.1, 6.0.12021Organization: e-corp-demo22Package manager: npm23Target file: package-lock.json24Project name: blinker-fluids25Open source: no26Project path: 27/home/mconradt/Documents/HTB/Challenges/web_blinkerfluids/challenge28Licenses: enabled
Hack The Boxのチャレンジは、脆弱性とその悪用方法を楽しく学べる方法です。今回のチャレンジでは、Snykがアプリケーションの依存関係をすばやく分析し、悪用方法に関する情報とともに重大なRCE脆弱性を提示してくれたため、攻略できました。また、アプリケーション開発者向けに、問題の修正方法も提示されました。