Security checks switched off to make it work
Recognise protections turned off to get past an error: `verify=False`, Go's `InsecureSkipVerify`, Node's `rejectUnauthorized: false`, `Access-Control-Allow-Origin: *`, disabled CSRF protection and `chmod 777`. Explain the attack each one opens up.
Builds on: Agents optimise the signal they can see, Trust boundaries and untrusted input
One argument, and the SSL error is gone
You asked the agent to get the report script talking to the internal metrics API. It failed with `SSLError: CERTIFICATE_VERIFY_FAILED`. Two minutes later the agent reports: "Fixed, the script runs now." The diff adds one argument: `requests.get(url, verify=False)`. The error really is gone. What did you just give away, and what would a real fix have looked like?
The error was the protection working
Before sending anything, the script asks: "is this really the metrics server?" The server shows its certificate, which is signed by your company's internal CA. By default requests trusts only well-known public CAs, so it can't confirm that signature and stops. The check did its job.
`verify=False` stops asking. Whoever answers is accepted, whether that is the real API or an attacker on the network. `verify="/path/to/internal-ca.pem"` gives the script the right answer: it still checks every certificate, now against your internal CA. The agent chased the proxy signal "error gone" and couldn't know which CA you use.
**Later cost:** nothing ever fails again, so the hole ships silently. A `# dev only` comment next to the flag doesn't stop it running in production.
CORS, CSRF and permission errors work the same way: the protection is doing its job.
verify=False
script ──▶ [attacker?] ──▶ API
no check: anyone answering is accepted
verify="internal-ca.pem"
script ──cert checked vs internal CA──▶ API ✓
script ──impostor's cert──▶ rejected ✗
Six tells and the attack each opens
- `verify=False` (Python), `InsecureSkipVerify: true` (Go), `rejectUnauthorized: false` or `NODE_TLS_REJECT_UNAUTHORIZED=0` (Node) → man-in-the-middle: anyone on the network path can pose as the server and read or alter the traffic.
- `Access-Control-Allow-Origin: *` → any site's scripts can read responses that need no login, e.g. an internal API reachable from the user's network. Echoing any `Origin` with credentials is worse: any site can read logged-in users' data.
- CSRF disabled (cookie login) → other sites can make a logged-in user's browser submit actions with their cookie.
- `chmod 777` → every local user and process can read, rewrite and execute the file.
Go: a client that trusts anyone
The agent's summary: "Fixed the `x509: certificate signed by unknown authority` error." The tell is `InsecureSkipVerify: true`. Go now skips both the certificate-chain check and the hostname check. Any server that answers for the billing host is accepted, and every credential the client sends goes to it. **Better:** add the internal CA to an `x509.CertPool` and set it as `RootCAs`, so verification stays on.
// Go
--- a/billing/client.go
+++ b/billing/client.go
func newClient() *http.Client {
+ tr := &http.Transport{
+ TLSClientConfig: &tls.Config{
+ InsecureSkipVerify: true,
+ },
+ }
return &http.Client{
- Timeout: 10 * time.Second,
+ Transport: tr,
+ Timeout: 10 * time.Second,
}
}
CORS: the second fix is worse
You asked the agent to fix "blocked by CORS policy" for the new dashboard at `https://app.example.com`. First it sets `Access-Control-Allow-Origin: *`. The browser still refuses, because the dashboard's requests carry cookies and browsers reject `*` with credentials. The next fix echoes back whatever `Origin` arrives and adds `Access-Control-Allow-Credentials: true`. It works. It also means any page a logged-in user visits can read their data. **Better:** allow exactly `https://app.example.com`.
Give the check what it needs
A TLS, CORS, CSRF or permission error is usually the protection working. If the fix switches the check off instead of satisfying it (trust the right CA, allow the exact origin, send the token, set the right owner), reject it and name the attack it opens.
On Bytewise this lesson comes in small steps with a check at the end, and the app brings it back right before you would forget it.