Urgent.News

What's breaking now, across thousands of outlets.

Tech

What your site tells a stranger before it renders a single pixel

Type a domain, hit enter, and before anything paints, your server and the browser have already had a short conversation. The server sends back response headers — and to anyone who knows how to read them, those headers are a fairly candid statement about how seriously that site takes its own security. Attackers read them first. Not because headers are exciting, but because they're free: no login,…

Before a website renders even a single pixel, a visitor's request triggers a brief exchange between their browser and the server. The server sends response headers, which are essentially a candid disclosure of the site's security stance. Cyber attackers scrutinize these headers first, not out of interest but because they're accessible without any login or exploit, and they don't leave any traces in server logs. Here's what to look for when analyzing these headers:

1. Strict-Transport-Security (HSTS): This header informs browsers to only communicate with the site over HTTPS, thereby preventing potential man-in-the-middle attacks in a hostile network. Without HSTS, an attacker can intercept the initial HTTP request and redirect the user to the plaintext version, bypassing the security measure. An adequately set HSTS with a max-age of at least a year and includeSubDomains ensures robust security.

2. Content-Security-Policy (CSP): This header restricts the sources from which scripts can be executed on the site. If present, it significantly reduces the risk of Cross-Site Scripting (XSS) attacks. However, the absence of a CSP or the use of 'unsafe-inline' in the script-src attribute can render the site vulnerable to such attacks. Sites with a well-configured CSP show a commitment to security that is often absent in others.

3. Set-Cookie attributes: The session cookie is crucial for maintaining logged-in users. The HttpOnly attribute prevents JavaScript from accessing the cookie, while Secure ensures the cookie is only sent over HTTPS, and SameSite=Lax restricts cross-site request forgery (CSRF). A cookie lacking these attributes puts the site's users at risk of account theft.

4. Server / X-Powered-By headers: These headers reveal the server software and version, making it easier for attackers to identify known vulnerabilities. While removing such headers does not directly enhance security, it does make the site less susceptible to targeted attacks based on software version. Additionally, it helps users assess the site's maintenance and security practices.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Ten Great DevOps Job Opportunities

DevOps.com is now providing a weekly DevOps jobs report through which opportunities for DevOps professionals will be highlighted as part of an effort to better serve our audience.

[$] The rest of the 7.3 merge window

By the time Linus Torvalds released 7.3-rc1 and closed the merge window for this release, 15,267 non-merge changesets had been pulled into the mainline repository.

More from Monday 31 August →