X-XSS-Protection
header is typically enabled by default in modern browsers. When the header value is set to false (0), cross-site scripting protection is disabled.X-XSS-Protection
header is explicitly disabled which might increase the risk of cross-site scripting attacks.X-XSS-Protection
header is typically enabled by default in modern browsers. When the header value is set to false (0), cross-site scripting protection is disabled.
<http auto-config="true">
...
<headers>
...
<xss-protection xss-protection-enabled="false" />
</headers>
</http>
X-XSS-Protection
header is explicitly disabled which may increase the risk of cross-site scripting attacks.X-XSS-Protection
header is typically enabled by default in modern browsers. When the header value is set to false (0), cross-site scripting protection is disabled.X-XSS-Protection
header is explicitly disabled which may increase the risk of cross-site scripting attacks.X-XSS-Protection
header is typically enabled by default in modern browsers. When the header value is set to false (0), cross-site scripting protection is disabled.X-XSS-Protection
header was used by developers to control the browser's behavior and offer protection against cross-site scripting (XSS). Modern browsers have better built-in protections with the use of Content Security Policy
. Therefore, relying on X-XSS-Protection
header can introduce new risks.
...
var db = openDatabase('mydb', '1.0', 'Test DB', 2 * 1024 * 1024);
...
'mydb'
can access it.required
attribute. Specifying the field type makes sure that the input is checked against its type. One can even supply a customizable pattern
attribute that checks the input against a regular expression. However, this validation gets disabled when adding a novalidate
attribute on a form tag and a formnovalidate
attribute on a submit input tag.novalidate
attribute.Example 2: The following sample disables form validation via a
<form action="demo_form.asp" novalidate="novalidate">
E-mail: <input type="email" name="user_email" />
<input type="submit" />
</form>
formnovalidate
attribute.
<form action="demo_form.asp" >
E-mail: <input type="email" name="user_email" />
<input type="submit" formnovalidate="formnovalidate"/>
</form>
SECURE_CROSS_ORIGIN_OPENER_POLICY = 'unsafe-none'
Application_BeginRequest
is either empty or does not include a function call to set the X-Content-Type-Options
to nosniff
or attempts to remove that header.X-Content-Type-Options: nosniff
.X-Content-Type-Options
to nosniff
.X-Content-Type-Options: nosniff
for each page that could contain user-controllable content.net.http.DetectContentType()
to determine the response Content-Type:
...
resp, err := http.Get("http://example.com/")
if err != nil {
// handle error
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
content_type := DetectContentType(body)
...
X-Content-Type-Options
to nosniff
or explicitly disables this security header.X-Content-Type-Options: nosniff
.
<http auto-config="true">
...
<headers>
...
<content-type-options disabled="true"/>
</headers>
</http>
X-Content-Type-Options
to nosniff
or explicitly disables this security header.X-Content-Type-Options: nosniff
.X-Content-Type-Options
to nosniff
or explicitly disables this security header.X-Content-Type-Options: nosniff
.script-src
, img-src
, object-src
, style_src
, font-src
, media-src
, frame-src
, connect-src
.*
to indicate all or part of the source. None of the directives are mandatory. Browsers will either allow all sources for an unlisted directive or will derive its value from the optional default-src
directive. Furthermore, the specification for this header has evolved over time. It was implemented as X-Content-Security-Policy
in Firefox until version 23 and in IE until version 10, and was implemented as X-Webkit-CSP
in Chrome until version 25. Both of the names are deprecated in favor of the now standard name Content Security Policy
. Given the number of directives, two deprecated alternate names, and the way multiple occurrences of the same header and repeated directives in a single header are treated, there is a high probability that a developer might misconfigure this header.unsafe-inline
or unsafe-eval
defeats the purpose of CSP.script-src
directive is set but no script nonce
is configured.frame-src
is set but no sandbox
is configured.django-csp
configuration uses unsafe-inline
and unsafe-eval
insecure directives to allow inline scripts and code evaluation:
...
MIDDLEWARE = (
...
'csp.middleware.CSPMiddleware',
...
)
...
CSP_DEFAULT_SRC = ("'self'", "'unsafe-inline'", "'unsafe-eval'", 'cdn.example.net')
...
script-src
img-src
object-src
style_src
font-src
media-src
frame-src
connect-src
default-src
directive. Furthermore, the specification for this header has evolved over time. It was implemented as X-Content-Security-Policy
in Firefox until version 23, in Internet Explorer until version 10, and was implemented as X-Webkit-CSP
in Chrome until version 25. Both of the names are deprecated in favor of the now standard name Content Security Policy. Given the umber of directives, two deprecated alternate names, and the way multiple occurrences of the same header and repeat directives in a single header are treated, there is a high probability that a developer might misconfigure this header.X-Frame-Options
header to instruct the browser whether the application should be framed. Disabling or not setting this header can lead to cross-frame related vulnerabilities.X-Frame-Options
header:
<http auto-config="true">
...
<headers>
...
<frame-options disabled="true"/>
</headers>
</http>
script-src
, img-src
, object-src
, style_src
, font-src
, media-src
, frame-src
, connect-src
. These 8 directives take a source list as a value that specifies domains the site is allowed to access for a feature covered by that directive. Developers can use a wildcard *
to indicate all or part of the source. Additional source list keywords such as 'unsafe-inline'
and 'unsafe-eval'
provide more granular control over script execution but are potentially harmful. None of the directives are mandatory. Browsers either allow all sources for an unlisted directive or derive its value from the optional default-src
directive. Furthermore, the specification for this header has evolved over time. It was implemented as X-Content-Security-Policy
in Firefox until version 23 and in IE until version 10, and was implemented as X-Webkit-CSP
in Chrome until version 25. Both of these names are deprecated in favor of the now standard name Content Security Policy
. Given the number of directives, two deprecated alternate names, and the way multiple occurrences of the same header and repeated directives in a single header are treated, there is a high probability that a developer can misconfigure this header.default-src
directive:
<http auto-config="true">
...
<headers>
...
<content-security-policy policy-directives="default-src '*'" />
</headers>
</http>
script-src
, img-src
, object-src
, style_src
, font-src
, media-src
, frame-src
, connect-src
. These 8 directives take a source list as a value that specifies domains the site is allowed to access for a feature covered by that directive. Developers can use a wildcard *
to indicate all or part of the source. Additional source list keywords such as 'unsafe-inline'
and 'unsafe-eval'
provide more granular control over script execution but are potentially harmful. None of the directives are mandatory. Browsers either allow all sources for an unlisted directive or derive its value from the optional default-src
directive. Furthermore, the specification for this header has evolved over time. It was implemented as X-Content-Security-Policy
in Firefox until version 23 and in IE until version 10, and was implemented as X-Webkit-CSP
in Chrome until version 25. Both of these names are deprecated in favor of the now standard name Content Security Policy
. Given the number of directives, two deprecated alternate names, and the way multiple occurrences of the same header and repeated directives in a single header are treated, there is a high probability that a developer can misconfigure this header.*-src
directive has been configured with an overly permissive policy such as *
Example 1: The following django-csp
setting sets an overly permissive and insecure default-src
directive:
...
MIDDLEWARE = (
...
'csp.middleware.CSPMiddleware',
...
)
...
CSP_DEFAULT_SRC = ("'self'", '*')
...
Access-Control-Allow-Origin
is defined. With this header, a Web server defines which other domains are allowed to access its domain using cross-origin requests. However, exercise caution when defining the header because an overly permissive CORS policy can enable a malicious application to inappropriately communicate with the victim application, which can lead to spoofing, data theft, relay, and other attacks.
Response.AppendHeader("Access-Control-Allow-Origin", "*");
*
as the value of the Access-Control-Allow-Origin
header indicates that the application's data is accessible to JavaScript running on any domain.Access-Control-Allow-Origin
is defined. With this header, a Web server defines which other domains are allowed to access its domain using cross-origin requests. However, exercise caution when defining the header because an overly permissive CORS policy can enable a malicious application to inappropriately communicate with the victim application, which can lead to spoofing, data theft, relay, and other attacks.
<websocket:handlers allowed-origins="*">
<websocket:mapping path="/myHandler" handler="myHandler" />
</websocket:handlers>
*
as the value of the Access-Control-Allow-Origin
header indicates that the application's data is accessible to JavaScript running on any domain.Access-Control-Allow-Origin
is defined. With this header, a Web server defines which other domains are allowed to access its domain using cross-origin requests. However, exercise caution when defining the header because an overly permissive CORS policy can enable a malicious application to inappropriately communicate with the victim application, which can lead to spoofing, data theft, relay, and other attacks.
<?php
header('Access-Control-Allow-Origin: *');
?>
*
as the value of the Access-Control-Allow-Origin
header indicates that the application's data is accessible to JavaScript running on any domain.Access-Control-Allow-Origin
is defined. With this header, a Web server defines which other domains are allowed to access its domain using cross-origin requests. However, exercise caution when defining the header because an overly permissive CORS policy can enable a malicious application to inappropriately communicate with the victim application, which can lead to spoofing, data theft, relay, and other attacks.
response.addHeader("Access-Control-Allow-Origin", "*")
*
as the value of the Access-Control-Allow-Origin
header indicates that the application's data is accessible to JavaScript running on any domain.Access-Control-Allow-Origin
is defined. With this header, a Web server defines which other domains are allowed to access its domain using cross-origin requests. However, exercise caution when defining the header because an overly permissive CORS policy can enable a malicious application to inappropriately communicate with the victim application, which can lead to spoofing, data theft, relay, and other attacks.
play.filters.cors {
pathPrefixes = ["/some/path", ...]
allowedOrigins = ["*"]
allowedHttpMethods = ["GET", "POST"]
allowedHttpHeaders = ["Accept"]
preflightMaxAge = 3 days
}
*
as the value of the Access-Control-Allow-Origin
header indicates that the application's data is accessible to JavaScript running on any domain.Access-Control-Allow-Origin
is defined. With this header, a Web server defines which other domains are allowed to access its domain using cross-origin requests. However, exercise caution when defining the header because an overly permissive CORS policy can enable a malicious application to inappropriately communicate with the victim application, which can lead to spoofing, data theft, relay, and other attacks.
Response.AddHeader "Access-Control-Allow-Origin", "*"
*
as the value of the Access-Control-Allow-Origin
header indicates that the application's data is accessible to JavaScript running on any domain.
WebMessage message = new WebMessage(WEBVIEW_MESSAGE);
webview.postWebMessage(message, Uri.parse("*"));
*
as the value of the target origin indicates that the script is sending a message to a window regardless of its origin.
o.contentWindow.postMessage(message, '*');
*
as the value of the target origin indicates that the script is sending a message to a window regardless of its origin.Unsafe-URL
might cause applications to expose sensitive site and user data (including session token, usernames and passwords) to third-party sites.Referrer-Policy
header is introduced to control browser behavior related to the referrer header. The Unsafe-URL
option removes all restrictions and sends the referrer header with every request.
<http auto-config="true">
...
<headers>
...
<referrer-policy policy="unsafe-url"/>
</headers>
</http>
Content-Security-Policy-Report-Only
header provides the capability for web application authors and administrators to monitor security policies, rather than enforce them. This header is typically used when experimenting and/or developing security policies for a site. When a policy is deemed effective, you can be enforce it by using the Content-Security-Policy
header field instead.Report-Only
mode:
<http auto-config="true">
...
<headers>
...
<content-security-policy report-only="true" policy-directives="default-src https://content.cdn.example.com" />
</headers>
</http>
Content-Security-Policy-Report-Only
header provides the capability for web application authors and administrators to monitor security policies, rather than enforce them. This header is typically used when experimenting and/or developing security policies for a site. When a policy is deemed effective, you can enforce it by using the Content-Security-Policy
header instead.Report-Only
mode:
response.content_security_policy_report_only = "*"
...
String lang = Request.Form["lang"];
WebClient client = new WebClient();
client.BaseAddress = url;
NameValueCollection myQueryStringCollection = new NameValueCollection();
myQueryStringCollection.Add("q", lang);
client.QueryString = myQueryStringCollection;
Stream data = client.OpenRead(url);
...
lang
such as en&poll_id=1
, and then the attacker may be able to change the poll_id
at will.
...
String lang = request.getParameter("lang");
GetMethod get = new GetMethod("http://www.example.com");
get.setQueryString("lang=" + lang + "&poll_id=" + poll_id);
get.execute();
...
lang
such as en&poll_id=1
, and then the attacker will be able to change the poll_id
at will.
<%
...
$id = $_GET["id"];
header("Location: http://www.host.com/election.php?poll_id=" . $id);
...
%>
name=alice
specified, but they have added an additional name=alice&
, and if this is being used on a server that takes the first occurrence, then this may impersonate alice
in order to get further information regarding her account.
<authorization>
<allow verbs="GET,POST" users="admin"/>
<deny verbs="GET,POST"users="*" />
</authorization>
<security-constraint>
<display-name>Admin Constraint</display-name>
<web-resource-collection>
<web-resource-name>Admin Area</web-resource-name>
<url-pattern>/pages/index.jsp</url-pattern>
<url-pattern>/admin/*.do</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<description>only admin</description>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
<http-method>
tag in this configuration, it might be possible to exercise administrative functionality by substituting GET or POST requests with HEAD requests. For HEAD requests to exercise administrative functionality, condition 3 must hold - the application must carry out commands based on verbs other than POST. Some web/application servers will accept arbitrary non-standard HTTP verbs and respond as if they were given a GET request. If that is the case, an attacker would be able to view administrative pages by using an arbitrary verb in a request.
GET /admin/viewUsers.do HTTP/1.1
Host: www.example.com
FOO /admin/viewUsers.do HTTP/1.1
Host: www.example.com
rawmemchr()
.
int main(int argc, char** argv) {
char* ret = rawmemchr(argv[0], 'x');
printf("%s\n", ret);
}
argv[0]
, but it might end up printing some portion of memory located above argv[0]
.private
and final
, then mistakenly creates a method that mutates the Set.
@Immutable
public final class ThreeStooges {
private final Set stooges = new HashSet>();
...
public void addStooge(String name) {
stooges.add(name);
}
...
}