{"success":true,"message":"Post fetched","data":{"slug":"7-a3-injection-cross-site-scripting","title":"(A3) Injection - Cross Site Scripting - Webgoat","date":"22-3-2024","dateValue":1711065600000,"description":"🐐 Bài viết này mình sẽ hướng dẫn các bạn làm phần (A3) Injection - Cross Site Scripting","tags":["webgoat"],"thumbnail":"https://res.cloudinary.com/dhs93uix6/image/upload/v1737164721/ypypr9rz5zniqkjrbssw.jpg","readTime":"","author":"Admin","contentHtml":"<p><img src=\"https://res.cloudinary.com/dhs93uix6/image/upload/v1711097747/WebGoat/WebGoat_ad2axz.png\" alt=\"alt\"></p>\n<h2>1. What is XSS?</h2>\n<ul>\n<li>Mở đường link hiện tại trong một tab thứ 2. Nhập <code>alert(document.cookie);</code> vào Tab Console trên trình duyệt và nhấn Enter:</li>\n</ul>\n<p><img src=\"https://res.cloudinary.com/dhs93uix6/image/upload/v1711201759/WebGoat/H55_zahlcb.png\" alt=\"alt\"></p>\n<ul>\n<li>Quay trở lại trang trước tick vào <strong>&quot;The cookies are the same on each tab&quot;</strong> và nhấn Submit:</li>\n</ul>\n<p><img src=\"https://res.cloudinary.com/dhs93uix6/image/upload/v1711201758/WebGoat/H56_fsql79.png\" alt=\"alt\"></p>\n<h2>2. Try It! Reflected XSS</h2>\n<ul>\n<li>Nhập đoạn code sau vào ô <strong>Enter your credit card number</strong> và nhấn Purchase:</li>\n</ul>\n<pre><code class=\"hljs language-javascript\">&lt;script&gt;<span class=\"hljs-title function_\">alert</span>(<span class=\"hljs-string\">&quot;XSS Test&quot;</span>)&lt;/script&gt;\n</code></pre><p><img src=\"https://res.cloudinary.com/dhs93uix6/image/upload/v1711201758/WebGoat/H57_egugfr.png\" alt=\"alt\"></p>\n<h2>3. Identify potential for DOM-Based XSS</h2>\n<ul>\n<li>Tìm đến file <code>GoatRouter.js</code> trong Tab Sources. Nhập <code>start.mvc#test/</code> và Submit:</li>\n</ul>\n<p><img src=\"https://res.cloudinary.com/dhs93uix6/image/upload/v1711201759/WebGoat/H58_ivqmqv.png\" alt=\"alt\"></p>\n<h2>4. Try It! DOM-Based XSS</h2>\n<ul>\n<li>Đi đến trang: <a href=\"http://127.0.0.1:8080/WebGoat/start.mvc#test/WhateverYouType\" title=\"http://127.0.0.1:8080/WebGoat/start.mvc#test/WhateverYouType\">http://127.0.0.1:8080/WebGoat/start.mvc#test/WhateverYouType</a>.</li>\n</ul>\n<p><img src=\"https://res.cloudinary.com/dhs93uix6/image/upload/v1711201758/WebGoat/H59_dkqlq1.png\" alt=\"alt\"></p>\n<ul>\n<li><p>Đinh đến trang: <a href=\"http://127.0.0.1:8080/WebGoat/start.mvc#test/%3Cscript%3Ewebgoat.customjs.phoneHome%28%29%3C%2Fscript%3E\" title=\"http://127.0.0.1:8080/WebGoat/start.mvc#test/%3Cscript%3Ewebgoat.customjs.phoneHome%28%29%3C%2Fscript%3E\">http://127.0.0.1:8080/WebGoat/start.mvc#test/%3Cscript%3Ewebgoat.customjs.phoneHome%28%29%3C%2Fscript%3E</a></p>\n</li>\n<li><p>Ta sẽ thấy được một con số là: -1588312798</p>\n</li>\n</ul>\n<p><img src=\"https://res.cloudinary.com/dhs93uix6/image/upload/v1711201760/WebGoat/H60_ejgsin.png\" alt=\"alt\"></p>\n<ul>\n<li>Dán số đó vào và Submit:</li>\n</ul>\n<p><img src=\"https://res.cloudinary.com/dhs93uix6/image/upload/v1711201759/WebGoat/H61_tjqf0g.png\" alt=\"alt\"></p>\n"}}