BaCheWork and records of a photonics research workhorse
Language

Ask what attackers want first: test the site before hardening it

Attackers usually want not your web pages but your keys and login sessions. This post starts from a game-launcher trojan and a post about a cloud bill that spiked, and explains how I first hit my own site with the paths a scanner would try, looked up DNS and accounts, and only then decided what to fix.

Type
Essay
Published
2026-11-22
Updated
2026-11-22

This series follows “Building a portfolio website yourself”. The chapter 7 of the site-building series covers the principles of static site security; this series is the record of how I actually hardened security on my own site: what I found, what I fixed, and how I confirmed the fix really took effect.

Background: two things that came up around the same time

A game launcher was trojanized. Since late September 2026, several JavaScript files that the PC launcher for NIKKE downloads from its official CDN have been tampered with, and some players ended up with a remote-control trojan installed. According to a community technical summary, it steals saved browser passwords and login sessions, as well as things like SSH and API keys. The official side fixed it and announced the fix in early November. At the time I built a checker tool for my own machine (its detection part is read-only and changes nothing), and the facts are summarized in nikke-k2f-check.

A post about a cloud bill that spiked. Someone on Threads shared: their cloud costs suddenly soared because a flood of crawlers was fetching .env files and burning through their traffic..env often holds passwords and API keys, and these requests are automated scans that look specifically for config files that others made public by accident.

The two share one thing: attackers want keys and login sessions, not website content. One steals from a user’s computer; the other scans the internet for files that were exposed by mistake.

So when hardening a website, the first question is not “which protections should I install?” but “what do I have that an attacker would want, and where is it right now?”

Test first, don’t assume

I didn’t start by adding protections down a checklist one by one. Instead, I first hit my own site with the things a scanner would try. The table below shows the results as of the 2026-11-04 assessment; some items were fixed later that same day.

Question to answer How I checked Result at the time of assessment
Did config files leak? Sent ordinary requests to my own site for /.git/config, /wp-login.php, /package.json, and the deployment config file All returned 404; source and config were not public
If the site gets scanned, does the bill spike? Checked the plan and official documentation The free plan’s Worker has a daily limit of 100,000 requests; beyond that, it returns errors (official docs say this case returns 429) instead of continuing to serve and billing me. My pages pass through the Worker first, so for me the risk is “temporarily unreachable,” not money
Does the site load JavaScript from other sites? Fetched the homepage and checked for <script src> No. The path the launcher incident used (loading programs from someone else’s CDN) does not exist on the main site
Security headers curl.exe -I and checked the response headers A few basic ones are present; no HSTS to force HTTPS (deliberately postponed), and no header to stop other sites from framing it
Can someone spoof my domain to send email? Checked SPF, DMARC, and MX in DNS None of the three. Anyone can forge mail from @我的網域 to send phishing
Can the password on the subsite be brute-forced? Read the subsite’s source The password is checked on the server, but there is no attempt limit
Is this computer clean? Ran my own checker (read-only) No known traces found; one check had to be rerun in a PowerShell window I opened myself before it counted
The account itself Dashboard profile settings → verification method Two-step verification was not enabled on my Cloudflare account

The last row was the biggest hole this time. The first section of chapter 7 of the site-building series says “turn on two-factor authentication for Cloudflare,” and yet my own account didn’t have it on.

Conclusion: the real risk is “computer + account”

After a full round of checks, the website itself is not easy to break into: the main site is static pages with no member login, and only a small database is used for page view counts. The real risk chain is:

  1. The computer gets infected (like that launcher trojan), or the account password gets phished.
  2. The attacker obtains the deployment credentials stored on the computer and can directly overwrite the entire site.
  3. Or they get a logged-in session to the Cloudflare dashboard: beyond changing the site, they can also change DNS and transfer the domain away.

None of the website’s own protections is needed to block this chain. So the fix order is account first, then domain, and finally the website edge:

Order What to fix Which chapter in this series
1 Two-step verification for the account, things to watch when signing in with Google, and expiry limits on deployment credentials Chapter 2
2 Domain: a domain that doesn’t send mail should also declare that it doesn’t Chapter 3
3 Website edge: block scanning paths, limit attempts on password pages, add headers Chapter 4
4 Recoverable and visible: restore drills, seeing what the firewall blocked Chapter 5
5 Keep protections from silently failing: a checklist plus periodic re-checks Chapter 6

If the site quotes prices or takes orders, see chapter 7: the two techniques needed only for dynamic sites.

The first step you can follow

You don’t need to understand every protection first. Just answer three questions:

  1. What does an attacker want from me? Usually an account that can log into the dashboard, deployment credentials, or API keys in the code.
  2. Where are these things right now? Which account, which computer, which file.
  3. What can be seen from outside? Send one request with curl.exe to /.env and /.git/config, check your domain’s DNS once, and log into the dashboard to see whether two-step verification is on.
curl.exe -s -o NUL -w "%{http_code}`n" https://example.com/.env

A 404 or 403 response is correct; a 200 means act right away. Replace example.com with your domain.

Checking first and fixing afterward works better than blindly patching down a checklist: you’ll know which items are real holes and which were fine all along.

Sources

  1. nikke-k2f-check: the NIKKE launcher trojan checker and fact list (My own fact list, each item with its source)
  2. Threads: cloud bill spiked from .env scanning (Social media post, paraphrased only)
  3. Cloudflare Workers: Limits (daily request cap on the free plan) (Official documentation)
  4. Cloudflare Workers: Static assets billing and limitations (run_worker_first returns 429 over the limit) (Official documentation)

Related:Security for a static personal site: where the real risks are

Next:Does switching to Google sign-in already mean two-step verification? →