{"id":1759,"date":"2017-11-26T08:39:31","date_gmt":"2017-11-26T16:39:31","guid":{"rendered":"https:\/\/www.cloudinsidr.com\/content\/?p=1759"},"modified":"2017-11-29T18:46:43","modified_gmt":"2017-11-30T02:46:43","slug":"set-report-uri-prevent-code-injection-attacks","status":"publish","type":"post","link":"https:\/\/www.cloudinsidr.com\/content\/set-report-uri-prevent-code-injection-attacks\/","title":{"rendered":"How to set up Report URI to prevent code injection attacks"},"content":{"rendered":"<p>A web service called <a href=\"https:\/\/report-uri.com\/\" target=\"_blank\" rel=\"noopener\">Report URI<\/a>\u00a0can be a great help in creating an HTTP security policy that will protect your web application without compromising its functionality. Here is how to set it up to bolster your defenses against code injection attacks.<\/p>\n<p><!--more--><\/p>\n<p>Code injection attacks pose a massive danger to any web application that&#8217;s exposed to the world. It literally takes minutes after a domain registration for the evildoers to come sniffing around. Chance are, they will keep coming back until the day they break in to vandalize your web application, hijack a user session or steal data some other way.\u00a0By setting HTTP Security Headers, you can reasonably prevent code injection attacks in most cases (for more, read: <em><a href=\"https:\/\/www.cloudinsidr.com\/content\/fixing-your-web-servers-security-headers-from-hall-of-shame-to-hall-of-fame\/\" target=\"_blank\" rel=\"bookmark noopener\">Fixing your Web Server\u2019s Security Headers: From Hall of Shame to Hall of Fame<\/a><\/em>). A Content Security Policy header can effectively suppress code injection attacks.<\/p>\n<p>There is no better way to define your content security headers than by using <a href=\"https:\/\/report-uri.com\/\">Report URI<\/a>. Here is how to set it up.<\/p>\n<p>The service allows you to obtain an\u00a0report-uri endpoint for use with the directive Content-Security-Policy-Report-Only to log security incidents that violate your security policy as a result of user interactions with your web application.<\/p>\n<h3>Step 1. Obtain an\u00a0<strong>report-uri endpoint\u00a0<\/strong><\/h3>\n<p>In your web browser, navigate to<\/p>\n<pre><a href=\"https:\/\/report-uri.com\/account\/setup\/\" target=\"_blank\" rel=\"noopener\">https:\/\/report-uri.com\/<\/a><\/pre>\n<p>Sign-in to your account and head over to\u00a0the <strong>Setup<\/strong> section. From the list of\u00a0<strong>report-uri<\/strong> endpoints, select the address titled\u00a0<strong>Content-Security-Policy-Report-Only<\/strong>\u00a0and copy it to your clipboard.<\/p>\n<figure id=\"attachment_1746\" aria-describedby=\"caption-attachment-1746\" style=\"width: 760px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.cloudinsidr.com\/content\/secure-your-web-server-against-attacks-via-xsrfcsrfxfs-how-to-design-a-content-security-policy\/csp_headers-01\/\" target=\"_blank\" rel=\"attachment noopener wp-att-1746\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-1746\" src=\"https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2016\/02\/CSP_headers-01.png\" alt=\"For debugging and testing your HTTP Content Security Policy header, use a report-uri endpoint of the type Content-Security-Policy-Report-Only \" width=\"760\" height=\"491\" srcset=\"https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2016\/02\/CSP_headers-01.png 858w, https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2016\/02\/CSP_headers-01-600x387.png 600w, https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2016\/02\/CSP_headers-01-300x194.png 300w, https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2016\/02\/CSP_headers-01-768x496.png 768w\" sizes=\"(max-width: 760px) 100vw, 760px\" \/><\/a><figcaption id=\"caption-attachment-1746\" class=\"wp-caption-text\">For debugging and testing, use a report-uri endpoint of the type Content-Security-Policy-Report-Only<\/figcaption><\/figure>\n<p>Next, you will want to enter this address into your web server configuration for your domain, but before the service will start collecting information, you have to do one more thing: define the domains to collect reports for.<\/p>\n<h3>Step 2. Enter eligible domains to collect security incident reports for<\/h3>\n<p>Navigate to the Filters section. Enter all the domains you want to keep an eye on into the field &#8220;Sites to collect reports for&#8221;, without the scheme, separated by a space:<\/p>\n<pre>domain1.tld domain2.tld domain3.tld<\/pre>\n<figure id=\"attachment_1760\" aria-describedby=\"caption-attachment-1760\" style=\"width: 760px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.cloudinsidr.com\/content\/set-report-uri-prevent-code-injection-attacks\/csp_headers-03_filtersupdated\/\" target=\"_blank\" rel=\"attachment noopener wp-att-1760\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-1760\" src=\"https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2017\/11\/CSP_headers-03_filtersUpdated.png\" alt=\"Report URI: enter eligible domains to collect reports for\" width=\"760\" height=\"383\" srcset=\"https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2017\/11\/CSP_headers-03_filtersUpdated.png 1332w, https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2017\/11\/CSP_headers-03_filtersUpdated-600x303.png 600w, https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2017\/11\/CSP_headers-03_filtersUpdated-300x151.png 300w, https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2017\/11\/CSP_headers-03_filtersUpdated-768x387.png 768w, https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2017\/11\/CSP_headers-03_filtersUpdated-1024x517.png 1024w\" sizes=\"(max-width: 760px) 100vw, 760px\" \/><\/a><figcaption id=\"caption-attachment-1760\" class=\"wp-caption-text\">Report URI: enter eligible domains to collect reports for<\/figcaption><\/figure>\n<p>The service Report URI is now ready to collect reports\u2014but is your web server ready to ask user agents to submit them?<\/p>\n<h3>Step 3. Configure your web server to use the report-uri endpoint<\/h3>\n<p>Setting up your web server to use your report-uri endpoint involvs adding a directive to your web server configuration file (see\u00a0<a href=\"https:\/\/www.cloudinsidr.com\/content\/secure-your-web-server-against-attacks-via-xsrfcsrfxfs-how-to-design-a-content-security-policy\/\" target=\"_blank\" rel=\"noopener\"><em>How to Create a Content Security Policy to Protect Your Web Application against XSRF\/CSRF\/XFS, Clickjacking and Other Code Injection Attacks<\/em><\/a> for details). After a brief delay, the reports of any incidents that violate your current polity should begin streaming in. You will find them in the CSP section of your Report URI account.<\/p>\n<blockquote class=\"wp-embedded-content\" data-secret=\"G8j6kzSbnN\"><p><a href=\"https:\/\/www.cloudinsidr.com\/content\/secure-your-web-server-against-attacks-via-xsrfcsrfxfs-how-to-design-a-content-security-policy\/\">Create a Content Security Policy to Protect Your Web Application against XSRF\/CSRF\/XFS, Clickjacking and Other Code Injection Attacks<\/a><\/p><\/blockquote>\n<p><iframe class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Create a Content Security Policy to Protect Your Web Application against XSRF\/CSRF\/XFS, Clickjacking and Other Code Injection Attacks&#8221; &#8212; Cloud Insidr\" src=\"https:\/\/www.cloudinsidr.com\/content\/secure-your-web-server-against-attacks-via-xsrfcsrfxfs-how-to-design-a-content-security-policy\/embed\/#?secret=JO94iAR1gK#?secret=G8j6kzSbnN\" data-secret=\"G8j6kzSbnN\" width=\"500\" height=\"282\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n<h3>Step 4. Analyze Report-URI incidents<\/h3>\n<p>Don&#8217;t just allow the reports to roll in, you need to take action.<\/p>\n<p>Here is an example of an attempted code injection attack on our sister site <a href=\"https:\/\/www.digitalmastersmag.com\/magazine\/\" target=\"_blank\" rel=\"noopener\">Digital Masters Magazine<\/a>. Attackers attempted to collect data using a 1 px image; the attempt failed thanks to the Content Security Policy in place.<\/p>\n<figure id=\"attachment_1765\" aria-describedby=\"caption-attachment-1765\" style=\"width: 760px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.cloudinsidr.com\/content\/set-report-uri-prevent-code-injection-attacks\/script_blocked\/\" target=\"_blank\" rel=\"attachment noopener wp-att-1765\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-1765\" src=\"https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2017\/11\/script_blocked.png\" alt=\"Script execution blocked thanks to a Content Security Policy\" width=\"760\" height=\"506\" srcset=\"https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2017\/11\/script_blocked.png 1418w, https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2017\/11\/script_blocked-600x399.png 600w, https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2017\/11\/script_blocked-300x200.png 300w, https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2017\/11\/script_blocked-768x511.png 768w, https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2017\/11\/script_blocked-1024x682.png 1024w\" sizes=\"(max-width: 760px) 100vw, 760px\" \/><\/a><figcaption id=\"caption-attachment-1765\" class=\"wp-caption-text\">Script execution blocked thanks to a Content Security Policy<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>A web service called Report URI\u00a0can be a great help in creating an HTTP security policy that will protect your web application without compromising its functionality. Here is how to set it up to bolster your defenses against code injection attacks.<\/p>\n","protected":false},"author":1,"featured_media":1766,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[33,214],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v14.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to set up Report URI to prevent code injection attacks - CloudInsidr<\/title>\n<meta name=\"robots\" content=\"index, follow\" \/>\n<meta name=\"googlebot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta name=\"bingbot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.cloudinsidr.com\/content\/set-report-uri-prevent-code-injection-attacks\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to set up Report URI to prevent code injection attacks - CloudInsidr\" \/>\n<meta property=\"og:description\" content=\"A web service called Report URI\u00a0can be a great help in creating an HTTP security policy that will protect your web application without compromising its functionality. Here is how to set it up to bolster your defenses against code injection attacks.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.cloudinsidr.com\/content\/set-report-uri-prevent-code-injection-attacks\/\" \/>\n<meta property=\"og:site_name\" content=\"CloudInsidr\" \/>\n<meta property=\"article:published_time\" content=\"2017-11-26T16:39:31+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-11-30T02:46:43+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2017\/11\/CSP_headers-03_reportsNew.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1666\" \/>\n\t<meta property=\"og:image:height\" content=\"637\" \/>\n<meta name=\"twitter:card\" content=\"summary\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.cloudinsidr.com\/content\/#website\",\"url\":\"https:\/\/www.cloudinsidr.com\/content\/\",\"name\":\"CloudInsidr\",\"description\":\"Cyber security, infotech\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/www.cloudinsidr.com\/content\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.cloudinsidr.com\/content\/set-report-uri-prevent-code-injection-attacks\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2017\/11\/CSP_headers-03_reportsNew.png\",\"width\":1666,\"height\":637,\"caption\":\"Fixing CSP headers\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.cloudinsidr.com\/content\/set-report-uri-prevent-code-injection-attacks\/#webpage\",\"url\":\"https:\/\/www.cloudinsidr.com\/content\/set-report-uri-prevent-code-injection-attacks\/\",\"name\":\"How to set up Report URI to prevent code injection attacks - CloudInsidr\",\"isPartOf\":{\"@id\":\"https:\/\/www.cloudinsidr.com\/content\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.cloudinsidr.com\/content\/set-report-uri-prevent-code-injection-attacks\/#primaryimage\"},\"datePublished\":\"2017-11-26T16:39:31+00:00\",\"dateModified\":\"2017-11-30T02:46:43+00:00\",\"author\":{\"@id\":\"https:\/\/www.cloudinsidr.com\/content\/#\/schema\/person\/dd6ee9cb21cf05763fd7cff3d6f11b2b\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.cloudinsidr.com\/content\/set-report-uri-prevent-code-injection-attacks\/\"]}]},{\"@type\":[\"Person\"],\"@id\":\"https:\/\/www.cloudinsidr.com\/content\/#\/schema\/person\/dd6ee9cb21cf05763fd7cff3d6f11b2b\",\"name\":\"Cloud Insidr\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.cloudinsidr.com\/content\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/8b2fa1415b3d573b97d818b8f8f83b7c?s=96&d=mm&r=g\",\"caption\":\"Cloud Insidr\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/posts\/1759"}],"collection":[{"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/comments?post=1759"}],"version-history":[{"count":5,"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/posts\/1759\/revisions"}],"predecessor-version":[{"id":1774,"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/posts\/1759\/revisions\/1774"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/media\/1766"}],"wp:attachment":[{"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/media?parent=1759"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/categories?post=1759"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/tags?post=1759"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}