{"id":880,"date":"2018-10-18T20:36:17","date_gmt":"2018-10-18T20:36:17","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw92\/?p=880"},"modified":"2018-10-21T01:22:00","modified_gmt":"2018-10-21T01:22:00","slug":"owasp-security-shepherd-cross-site-scripting-one-solution-lsb-ls-blog","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/10\/18\/owasp-security-shepherd-cross-site-scripting-one-solution-lsb-ls-blog\/","title":{"rendered":"OWASP Security Shepherd \u2013 Cross Site Scripting One Solution \u2013 LSB \u2013 ls \/blog"},"content":{"rendered":"<p>Welcome back to LSB my budding hackers. Today\u2019s lesson is about Cross Site Scripting (Or XSS). Cross-Site Scripting (XSS) attacks are a type of injection, in which malicious scripts are injected into otherwise benign and trusted websites. XSS attacks occur when an attacker uses a web application to send malicious code, generally in the form of a browser side script, to a different end user. Flaws that allow these attacks to succeed are quite widespread and occur anywhere a web application uses input from a user within the output it generates without validating or encoding it.<\/p>\n<p><a href=\"https:\/\/shareasale.com\/r.cfm?b=1193747&amp;u=1803184&amp;m=59485&amp;urllink=&amp;afftrack=\" target=\"_blank\" rel=\"noopener\">REGISTER TODAY FOR YOUR KUBERNETES FOR DEVELOPERS (LFD259) COURSE AND CKAD CERTIFICATION TODAY! $499!<\/a><\/p>\n<p>An attacker can use XSS to send a malicious script to an unsuspecting user. The end user\u2019s browser has no way to know that the script should not be trusted, and will execute the script. Because it thinks the script came from a trusted source, the malicious script can access any cookies, session tokens, or other sensitive information retained by the browser and used with that site.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/linuxsecurityblog.files.wordpress.com\/2018\/09\/xss1.png?w=900\" alt=\"xss1\" \/><\/p>\n<p>So our task today is to get an alert on the web page to show that it\u2019s vulnerable to this type of attack. On the web page we are presented with a search box and that is all we have for this puzzle.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/linuxsecurityblog.files.wordpress.com\/2018\/09\/xss2.png?w=900\" alt=\"xss2\" \/><\/p>\n<p>A common piece of Javascript that hackers use to find out if a page is vulnerable to XSS is alert(\u201cXSS\u201d). This small bit of code is asking the web page to show us an alert prompt so that we know the page is vulnerable. Let\u2019s try it. Enter the code in the search box and click on the Get This User button.<\/p>\n<p><a href=\"https:\/\/shareasale.com\/r.cfm?b=1193744&amp;u=1803184&amp;m=59485&amp;urllink=&amp;afftrack=\" target=\"_blank\" rel=\"noopener\">$299 WILL ENROLL YOU IN OUR SELF PACED COURSE \u2013 LFS205 \u2013 ADMINISTERING LINUX ON AZURE!<\/a><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/linuxsecurityblog.files.wordpress.com\/2018\/09\/xss3.png?w=900\" alt=\"xss3\" \/><\/p>\n<p>This worked first time!!<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/linuxsecurityblog.files.wordpress.com\/2018\/09\/xss4.png?w=900\" alt=\"xss4\" \/><\/p>\n<p>Above is the alert message from injecting the Javascript into the page.<\/p>\n<h3>How to Protect Yourself<\/h3>\n<p>The primary defenses against XSS are described in the <a href=\"https:\/\/www.owasp.org\/index.php\/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet\">OWASP XSS Prevention Cheat Sheet<\/a>.<\/p>\n<p>Also, it\u2019s crucial that you turn off HTTP TRACE support on all web servers. An attacker can steal cookie data via Javascript even when document.cookie is disabled or not supported by the client. This attack is mounted when a user posts a malicious script to a forum so when another user clicks the link, an asynchronous HTTP Trace call is triggered which collects the user\u2019s cookie information from the server, and then sends it over to another malicious server that collects the cookie information so the attacker can mount a session hijack attack. This is easily mitigated by removing support for HTTP TRACE on all web servers.<\/p>\n<p>The <a href=\"https:\/\/www.owasp.org\/index.php\/ESAPI\">OWASP ESAPI project<\/a> has produced a set of reusable security components in several languages, including validation and escaping routines to prevent parameter tampering and the injection of XSS attacks. In addition, the <a href=\"https:\/\/www.owasp.org\/index.php\/Category:OWASP_WebGoat_Project\">OWASP WebGoat Project<\/a> training application has lessons on Cross-Site Scripting and data encoding.<\/p>\n<p>Thank for reading and don\u2019t forget to like, comment and of course, follow our blog. Until next time.<\/p>\n<p>QuBits 2018-09-12<\/p>\n<p><a href=\"https:\/\/linuxsecurityblog.com\/2018\/09\/12\/owasp-security-shepherd-cross-site-scripting-one-solution-lsb\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Welcome back to LSB my budding hackers. Today\u2019s lesson is about Cross Site Scripting (Or XSS). Cross-Site Scripting (XSS) attacks are a type of injection, in which malicious scripts are injected into otherwise benign and trusted websites. XSS attacks occur when an attacker uses a web application to send malicious code, generally in the form &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/10\/18\/owasp-security-shepherd-cross-site-scripting-one-solution-lsb-ls-blog\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;OWASP Security Shepherd \u2013 Cross Site Scripting One Solution \u2013 LSB \u2013 ls \/blog&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-880","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/880","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=880"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/880\/revisions"}],"predecessor-version":[{"id":1060,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/880\/revisions\/1060"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=880"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=880"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=880"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}