The primary attack enabled or facilitated by cookies without the HttpOnly flag is:
Cross-Site Scripting (XSS) attacks leading to Session Hijacking
Here's how it connects:
XSS (Cross-Site Scripting):
An attacker injects malicious JavaScript into a trusted website viewed by other users.
Cookie Theft via XSS:
Without the HttpOnly flag, the injected JavaScript can read cookies (e.g., session cookies) through document.cookie.
Session Hijacking:
The attacker sends the stolen cookie to themselves, allowing them to impersonate the victim and gain unauthorized access.
Summary:
User
content security policy vulnerability attack name
Assistant
The "cookie without HttpOnly flag" vulnerability refers to a security issue where a cookie is set by a web application without the HttpOnly attribute. This can make the cookie accessible to client-side scripts, such as JavaScript, increasing the risk of certain types of attacks—most notably Cross-Site Scripting (XSS) attacks.
What is the HttpOnly Flag?
The HttpOnly flag is an attribute you can set on cookies.
When set, it instructs the browser not to expose the cookie to client-side scripts.
This means JavaScript running in the browser cannot read or manipulate the cookie via document.cookie.
Cookies set with this flag can only be sent in HTTP(S) requests to the server.
Why is Missing HttpOnly a Vulnerability?
If cookies contain sensitive session identifiers (e.g., session ID tokens) and lack the HttpOnly flag, an attacker who successfully injects malicious JavaScript into the website (via XSS) could read the cookie.
With access to these cookies, the attacker may hijack the victim's session—impersonating them without needing their credentials.
This compromises user privacy and security.
Example of Vulnerable Cookie
http
Set-Cookie: sessionid=abc123; Path=/; Secure
Here, the cookie lacks HttpOnly.
The browser will expose this cookie to JavaScript on the page.
Additionally, consider setting the Secure flag to ensure cookies are sent only over HTTPS.
Implement proper input validation and output encoding to prevent XSS vulnerabilities, which often lead to cookie theft.
Summary
Vulnerability
Description
Risk
Mitigation
Cookie without HttpOnly
Cookies accessible via client-side script (JavaScript)
Theft of session tokens via XSS attacks
Set HttpOnly flag on sensitive cookies
Use Secure and SameSite flags
Prevent XSS vulnerabilities
If you are a developer or security engineer, setting the HttpOnly flag is a simple yet effective step to harden web application security regarding cookie management.
Vulnerability
Attack Name
Cookie without HttpOnly flag
Session Hijacking via Cross-Site Scripting (XSS)
So, the lack of HttpOnly doesn’t itself constitute an attack, but it enables session hijacking in the presence of an XSS vulnerability.
Additional notes:
Sometimes, this type of attack is simply called "Cookie Theft".
If the application is vulnerable to XSS, the absence of HttpOnly increases attack impact.
If you want the exact name of the attack enabled by missing HttpOnly cookies — it is:
Session Hijacking via XSS (Cookie Theft Attack)
The question “content security policy vulnerability attack name” is a bit broad because Content Security Policy (CSP) is a security mechanism designed to prevent or mitigate certain types of attacks, mainly cross-site scripting (XSS) and data injection attacks. However, when CSP is misconfigured, incomplete, or improperly implemented, it can leave your application vulnerable to attacks that CSP is meant to prevent.
Common attacks related to CSP misconfigurations or weaknesses:
1. Cross-Site Scripting (XSS)
If the CSP is too permissive or improperly configured (e.g., allowing unsafe-inline, unsafe-eval, or overly broad script-src like * or https:), attackers can still inject malicious scripts.
These injected scripts can perform XSS attacks.
2. Content Injection or Data Injection Attacks
Weak CSP can permit injection of malicious code or resources, like allowing external scripts from untrusted domains.
3. Clickjacking
Although usually mitigated via other headers (like X-Frame-Options), improper CSP frame-ancestors directive can enable clickjacking attacks.
Attack Names Related to CSP Vulnerabilities:
CSP Misconfiguration or Weakness
Attack Name / Description
Allowing unsafe-inline or unsafe-eval in script-src
Cross-Site Scripting (XSS)
Allowing too many or untrusted sources in script-src or others
Cross-Site Scripting (XSS) or Malicious Resource Injection
Absence or overly permissive default-src
Various injection attacks including XSS
Weak or missing frame-ancestors directive
Clickjacking
In Summary:
The primary attack that CSP aims to prevent is Cross-Site Scripting (XSS).
CSP Misconfiguration or Weakness results in XSS attacks still being possible—often referred to simply as "bypass of Content Security Policy to perform XSS".
There is no separate “CSP vulnerability” attack name per se; rather, the CSP is a defense mechanism whose failure leads to the original attack (XSS, injection, clickjacking).
So, the short answer is:
If CSP is improperly configured or missing, the common attack enabled or not prevented is Cross-Site Scripting (XSS) (often called CSP bypass XSS).