Fixes
Security and hardening
Brute-force logins, leaked keys, weak TLS, CSP and token mistakes on servers and web apps: how to find what is exposed and close it, step by step.

87 fixes
Problems in this area
87 of 87 fixes
- Entra ID token request fails: the request body must contain the parameter 'grant_type'
AADSTS90014: The request body must contain the following parameter: 'grant_type'.3 causes - Angular HttpClient does not add the X-XSRF-TOKEN header to a request
Request headers contain no X-XSRF-TOKEN5 causes - An [Authorize] endpoint rejects a request with a bearer token
401 Unauthorized4 causes - ASP.NET Core API rejects an Angular user's token: the signature key was not found
WWW-Authenticate: Bearer error="invalid_token", error_description="The signature key was not found"4 causes - ASP.NET Core rejects the token before checking it: IDX12741, three segments expected
IDX12741: JWT: '[PII of type 'System.String' is hidden. For more details, see https://aka.ms/IdentityModel/PII.]' must have three segments (JWS) or five segments (JWE).3 causes - A Microsoft Entra access token shows Invalid Signature when you check it yourself
Invalid Signature2 causes - An ASP.NET Core API answers 401 with Bearer error="invalid_token"
WWW-Authenticate: Bearer error="invalid_token"3 causes - git pull from Bitbucket Cloud over SSH is refused with a publickey error
Permission denied (publickey).6 causes - Box returns 'Invalid grant_type parameter or parameter missing'
Invalid grant_type parameter or parameter missing3 causes - Amazon Cognito /oauth2/token returns unauthorized_client
{"error":"unauthorized_client"}3 causes - Inline base64 images do not show because of the Content Security Policy
Refused to load the image 'data:image/png;base64,iVBORw0KGgo...' because it violates the following Content Security Policy directive: "img-src 'self'".3 causes - Video from a MediaSource is blocked: 'Content at ... may not load data from blob:'
Content at http://localhost:3000/ may not load data from blob:http://localhost:3000/...3 causes - The browser refuses to load a font because of your Content Security Policy
Refused to load the font 'data:font/woff;base64,...' because it violates the following Content Security Policy directive: "default-src 'self'".3 causes - The browser blocks a script because of your Content Security Policy
Refused to load the script 'https://cdn.example.com/lib.js' because it violates the following Content Security Policy directive: "script-src 'self'".5 causes - Azure Databricks REST API returns 403 with a Microsoft Entra token
403 User not authorized4 causes - ASP.NET Core cannot create the JWT because the signing key is too short or unusable
IDX10720: Unable to create KeyedHashAlgorithm for algorithm 'HS256', the key size must be greater than: '<bits>' bits, key has '<bits>' bits.3 causes - .NET cannot convert the string to a JwtSecurityToken
Token handler unable to convert the token to jwt token3 causes - AuthenticationException: your certificate validation callback returned false
The remote certificate was rejected by the provided RemoteCertificateValidationCallback.3 causes - SSH to an EC2 instance fails with Permission denied (publickey,gssapi-keyex,gssapi-with-mic)
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).3 causes - Cannot add a samaccountname claim to a Microsoft Entra ID token
The samaccountname claim is not in the token4 causes - gcloud init cannot finish the sign-in step
Error while trying to authenticate with gcloud init3 causes - git clone fails on a private GitHub repository
Permission denied (publickey).4 causes - git commit fails with a socket error after leaving the 1Password SSH agent
error: Could not connect to socket. Is the agent running?3 causes - Git for Windows does not use the settings in your SSH config
Permission denied (publickey).3 causes - A GitHub Actions SSH deploy step cannot log in to the server
ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain4 causes - SSH to GitHub asks to confirm the host, or hangs on that prompt
The authenticity of host 'github.com (140.82.112.3)' can't be established.2 causes - git push or clone to GitHub over HTTPS refuses a password that is correct
remote: Support for password authentication was removed on August 13, 2021.4 causes - GitHub refuses the SSH key you pasted
Key is invalid. You must supply a key in OpenSSH public key format4 causes - The Google OAuth client secret is not shown in Cloud Console
Client secret shows only ****abcd2 causes - Google sign-in stops with 'Error 400: invalid_request'
Error 400: invalid_request3 causes - Google sign-in stops with Error 400: redirect_uri_mismatch
Error 400: redirect_uri_mismatch3 causes - Users see the unverified app warning on Google sign-in
The unverified app screen appears before the Google consent screen3 causes - Google token request fails with unauthorized_client
unauthorized_client2 causes - Google sign-in with gapi.auth2 fails to start in a React app
gapi.auth2.getAuthInstance().signIn()2 causes - DelegateAuthenticationProvider no longer exists in the Microsoft Graph .NET SDK
The type or namespace name 'DelegateAuthenticationProvider' could not be found3 causes - A GUI program over SSH says it cannot open the display
Gtk-WARNING **: cannot open display: localhost:10.03 causes - ASP.NET Core JwtBearer throws IDX20803: Unable to obtain configuration from the metadata address
IDX20803: Unable to obtain configuration from: 'https://login.microsoftonline.com/<tenant>/v2.0/.well-known/openid-configuration'.3 causes - JavaMail cannot log in to Office 365 IMAP with an OAuth token
A01 NO AUTHENTICATE failed.3 causes - Jwts.parserBuilder() no longer compiles after upgrading JJWT
Compile error on Jwts.parserBuilder() after a version bump3 causes - JJWT rejects a token because the signature does not match
SignatureException thrown while parsing a signed JWT3 causes - A valid JWT fails to decode because its segments are base64url, not base64
System.FormatException: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.3 causes - jsonwebtoken rejects a token: invalid signature, jwt expired or jwt malformed
JsonWebTokenError: jwt malformed5 causes - JWT validation fails and the message only says PII is hidden
[PII of type 'System.String' is hidden. For more details, see https://aka.ms/IdentityModel/PII.]3 causes - JwtBearer code stops working after moving an ASP.NET Core API to .NET 8
context.SecurityToken as JwtSecurityToken returns null in OnTokenValidated3 causes - Keycloak blocks your single-page app with a CORS error
Access to XMLHttpRequest at 'https://auth.example.com/realms/main/protocol/openid-connect/token' from origin 'https://app.example.com' has been blocked by CORS policy2 causes - Angular app stuck on start while keycloak-js runs check-sso and the login status iframe
Failed to initialize adapter4 causes - Laravel answers a form or AJAX call with 419 Page Expired
419 | Page Expired5 causes - PHP LDAP in Laravel fails with Can't contact LDAP server over TLS
Can't contact LDAP server3 causes - Microsoft Graph rejects an access token with an invalid audience
Access token validation failure. Invalid audience.4 causes - An HTTPS page is blocked from loading an insecure http:// resource
Mixed Content: The page at 'https://example.com/' was loaded over HTTPS, but requested an insecure script 'http://example.com/app.js'. This request has been blocked; the content must be served over HTTPS.4 causes - Node.js HTTPS call fails with UNABLE_TO_VERIFY_LEAF_SIGNATURE
Error: unable to verify the first certificate3 causes - The token endpoint answers with unsupported_grant_type
unsupported_grant_type3 causes - OpenSSL cannot read my certificate: PEM routines, no start line
error:0909006C:PEM routines:get_name:no start line2 causes - Extracting a certificate and private key from a .p12 file fails
openssl pkcs12 -in file.p12 stops without writing the certificate or key3 causes - The certificate OpenSSL made has no Subject Alternative Name
No X509v3 Subject Alternative Name line in the output of openssl x509 -text2 causes - Paramiko fails now and then with Error reading SSH protocol banner
paramiko.ssh_exception.SSHException: Error reading SSH protocol banner2 causes - Paramiko key login fails after agreeing on rsa-sha2-512
Agreed upon 'rsa-sha2-512' pubkey algorithm2 causes - The browser warns about a SameSite cookie set from PHP
A cookie without a SameSite attribute triggers a browser warning in the console4 causes - Is my PHP application affected by PHP2Shell, and how do I mitigate it?
A scanner or advisory feed reports CVE-2026-109618 (RCE via OOM corruption) on your server6 causes - PyJWT decode fails with ValueError: Could not deserialize key data
ValueError: Could not deserialize key data.3 causes - PyJWT will not decode a Keycloak or RS256 token: algorithm errors
jwt.exceptions.InvalidAlgorithmError4 causes - Python rejects a self-signed certificate in the chain
SSL: CERTIFICATE_VERIFY_FAILED3 causes - redis-cli warns that a password on the command line may not be safe
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.3 causes - Redis logs a possible security attack from POST or Host commands
Possible SECURITY ATTACK detected. It looks like somebody is sending POST or Host: commands to Redis.3 causes - RestSharp sends the OAuth2 access token but the API answers access denied
401 Unauthorized3 causes - An API key or .env file was committed to a Git repository
remote: error: GH013: Repository rule violations found for refs/heads/main. (a push blocked because it contains a secret)5 causes - Spring Security rejects the Entra ID token: invalid claims
Error occurred while attempting to decode the Jwt. The ID Token contains invalid claims3 causes - Spring Boot cannot find a ClientRegistrationRepository bean for OAuth2 login
Parameter 0 of constructor ... required a bean of type 'org.springframework.security.oauth2.client.registration.ClientRegistrationRepository' that could not be found3 causes - Spring resource server: 'An error occurred while attempting to decode the Jwt'
An error occurred while attempting to decode the Jwt: Malformed Jwk set2 causes - Spring Security fails to resolve the issuer configuration for a JWT or Keycloak
java.lang.IllegalArgumentException: Unable to resolve the Configuration with the provided Issuer of "http://localhost:8080/realms/demo"3 causes - Spring Security cannot verify the CSRF token because the session is gone
403 Forbidden after the page has been open for a while3 causes - POST requests return 403 in Spring Security because the CSRF token is missing
403 Forbidden on POST, PUT, PATCH or DELETE while GET works4 causes - Changing the error response when a JWT is rejected in Spring Security
401 Unauthorized with a WWW-Authenticate: Bearer header for a rejected token2 causes - ssh-agent will not start or Git cannot use your SSH key
Error: ssh-add: illegal option -- apple-use-keychain4 causes - Your auth.log is full of Failed password and Invalid user attempts
Failed password for invalid user admin from 198.51.100.23 port 40122 ssh24 causes - git clone stops on the UseKeychain line of ~/.ssh/config
Bad configuration option: usekeychain3 causes - Git over SSH to GitHub hangs and times out on port 22
ssh: connect to host github.com port 22: Connection timed out3 causes - SSH to GitHub connects, then the server closes or resets the connection
kex_exchange_identification: Connection closed by remote host3 causes - SSH refuses your key and ends with Permission denied (publickey)
user@203.0.113.10: Permission denied (publickey).5 causes - ssh jump host fails on Windows because nc is not installed
/usr/bin/bash: line 0: exec: nc: not found3 causes - SSH warns that the remote host identification has changed
WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!3 causes - git pull over SSH fails because client and server share no signature algorithm for your key
sign_and_send_pubkey: no mutual signature supported3 causes - ssh ignores your EC2 .pem file because its permissions are too open
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @3 causes - Terminal ssh works, but VS Code Remote - SSH cannot connect or keeps dropping
Could not establish connection to "my-host"5 causes - VS Code Remote - SSH fails to set up the dynamic port forward
Failed to set up socket for dynamic port forward to remote port: connect ECONNREFUSED4 causes - VS Code Server will not start on an old Linux host because glibc is too old
Could not establish connection to "my-host": The VS Code Server failed to start.3 causes - ssh to a Windows machine says Connection refused on port 22
ssh: connect to host 192.168.1.20 port 22: Connection refused3 causes
Next step
Something here keeps breaking?
I fix these for clients and run the same stack in production myself.