XSS (Cross-Site Scripting)
- Client-side attack
- JavaScript
- HTML iFrame
- URL ends in .js
- Percent encoding %C (<) & %3E (>)
This blog is here to help those preparing for CompTIA exams. This is designed to help the exam candidate to understand the concepts, rather than trust a brain dump. CHECK OUT THE BLOG INDEXES!!!
HTTP Strict Transport Security (HSTS) is a web security policy mechanism that forces web browsers to interact with a website using only HTTPS (secure HTTP) connections, preventing man-in-the-middle attacks and protocol downgrade attacks. It achieves this by sending a "Strict-Transport-Security" HTTP response header from the server to the browser, instructing it to always use HTTPS for future visits to that site and its subdomains (if specified).
Here's a more detailed explanation:
How HSTS Works:
1. Initial HTTPS Connection: The first time a user accesses a website with HSTS enabled, they must connect using HTTPS, and the server sends back an HSTS header.
2. HSTS Header: The header includes a max-age directive, specifying how long (in seconds) the browser should remember to use HTTPS for that domain. It may also include includeSubDomains to apply the rule to all subdomains, and preload to allow the site to be included in a browser's built-in list of HSTS sites.
3. Browser Enforcement: For the duration specified by max-age, the browser will automatically convert any HTTP requests for that domain (even if typed as HTTP or accessed via an HTTP link) into HTTPS requests before sending them.
4. Preventing Browser Warnings: HSTS also prevents users from bypassing browser warnings about invalid or self-signed certificates, ensuring that secure connections are maintained.
Benefits of HSTS:
Protection against downgrade attacks: HSTS prevents attackers from forcing a browser to use the insecure HTTP protocol, protecting against attacks that try to intercept or manipulate communication.
Protection against cookie hijacking: By enforcing HTTPS, HSTS helps protect sensitive data like session cookies from being intercepted and misused by attackers.
Improved user experience: By automatically upgrading to HTTPS, HSTS eliminates the need for users to manually type "https://" or deal with browser security warnings.
Enhanced security posture: HSTS strengthens the overall security of a website by reducing the attack surface and preventing potential vulnerabilities.
Key Directives:
Limitations:
Initial HTTPS requirement: HSTS relies on the user agent receiving the HSTS header during an HTTPS connection, meaning the first connection to the website is still vulnerable.
Potential for site unavailability: If a website is not accessible over HTTPS, users will be unable to access it if they have HSTS enabled.
Complexities with subdomains and CDNs: Configuring HSTS correctly, especially with subdomains and content delivery networks (CDNs), can be complex.
Example Header: Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
This example sets the HSTS policy for one year, includes all subdomains, and allows for preloading.