IjyaLabs logo
IjyaLabs
Arsenal·Security

Security Cheat Sheet

A practical security reference for engineers covering OWASP risks, authentication, TLS, headers, secrets, APIs, logging, cloud controls, and incident triage.

17 min read·By Arun R Kaushik

How to Use This Sheet

Security work fails when it becomes a checklist detached from real systems.

Use this sheet as a field reference for design reviews, implementation checks, production troubleshooting, security triage, and audit preparation.

Situation Start here
Web application review OWASP Top 10, authentication, authorization, input handling
API review object authorization, schema validation, rate limits, logging
Login or account security MFA, password storage, session controls, recovery flow
TLS or certificate issue openssl s_client, certificate chain, SNI, protocol version
Browser security HSTS, CSP, frame controls, cookie flags, CORS
Secrets exposure repo scan, environment variables, vault use, rotation evidence
Cloud or host hardening IAM, network exposure, logging, encryption, patch state
Incident triage scope, timeline, evidence preservation, containment, recovery

Rule: prove the control with evidence. A policy statement is not enough if the system behavior says otherwise.


OWASP Top 10: 2025

Use the OWASP Top 10 as an awareness and review map, not as the full security program.

ID Risk What to check first
A01 Broken Access Control Object-level authorization, role checks, tenant isolation
A02 Security Misconfiguration default config, debug mode, exposed admin paths, unsafe headers
A03 Software Supply Chain Failures dependency inventory, lockfiles, CI integrity, package provenance
A04 Cryptographic Failures TLS, key storage, weak algorithms, sensitive data exposure
A05 Injection SQL, NoSQL, LDAP, command, template, expression injection
A06 Insecure Design missing abuse cases, weak workflows, unsafe trust boundaries
A07 Authentication Failures MFA, session handling, account recovery, password policy
A08 Software or Data Integrity Failures unsigned updates, unsafe deserialization, CI/CD tampering
A09 Security Logging and Alerting Failures missing audit trail, no alerting, poor investigation evidence
A10 Mishandling of Exceptional Conditions stack traces, unsafe error paths, inconsistent rollback behavior

Review pattern:

  1. Identify the asset and trust boundary.
  2. Identify who can act on it.
  3. Prove authorization on the server side.
  4. Validate input at the boundary.
  5. Confirm secrets, keys, logs, and errors are handled safely.
  6. Confirm monitoring can detect abuse.

Security Design Baseline

Control area Baseline question
Identity Who is the actor, and how is identity proven?
Authorization What is the actor allowed to do on this exact object?
Data classification What data is public, internal, confidential, regulated, or secret?
Trust boundary Where does untrusted input enter?
Secrets Where are credentials, tokens, and keys stored and rotated?
Logging Can abuse be reconstructed without exposing sensitive data?
Availability What prevents brute force, abuse, overload, and runaway cost?
Recovery What is the rollback, restore, and revocation path?

Design review prompt:

Actor -> action -> object -> decision point -> evidence -> alert -> recovery

If one part is missing, the control is incomplete.


Authentication

Authentication proves who the user or service is.

Check Good baseline
Password length allow passphrases; avoid short minimums
Maximum length support at least 64 characters
Password rules avoid forced composition rules that reduce usability
Breached passwords block known compromised passwords
MFA require for admins and high-risk operations
Login throttling rate-limit by account and risk signal, not only IP
Account recovery treat recovery as an authentication ceremony
Reauthentication require for password, MFA, email, payout, and admin changes

Do not:

  • silently truncate passwords
  • store passwords with SHA-256, MD5, or reversible encryption
  • expose whether an email or username exists during login or recovery
  • let internal admin or service accounts log in through public user flows

Useful implementation checks:

# TLS-protected login page
curl -I https://example.com/login

# Look for cookie flags after login
curl -vk -I https://example.com/

# Check rate-limit behavior with controlled test accounts only
for i in 1 2 3 4 5; do curl -s -o /dev/null -w "%{http_code}\n" https://example.com/login; done

Password Storage

Passwords need slow, adaptive hashing. Plain hashes are not enough.

Use case Recommended direction
New application Argon2id where available
Argon2id unavailable scrypt
Legacy compatibility bcrypt with adequate work factor
FIPS-constrained environment PBKDF2-HMAC-SHA-256 with high iteration count
Extra protection pepper stored outside the database

Password storage rules:

  • unique salt per password
  • adaptive work factor
  • constant-time comparison
  • no reversible encryption for passwords
  • no plain SHA-256, SHA-1, MD5, or fast hashes
  • planned migration for legacy hashes

Evidence to ask for:

algorithm, work factor, salt behavior, pepper storage, migration plan,
hash verification function, test evidence, and breach response procedure

Authorization and Access Control

Most serious application bugs are authorization bugs.

Pattern Risk Required control
Object ID in URL Insecure Direct Object Reference (IDOR) object-level authorization
Role shown in UI only client-side bypass server-side role enforcement
Tenant ID from request tenant escape derive tenant from authenticated context
Admin API hidden by route direct access authorization middleware
Export or report endpoint bulk data leak scope, approval, audit, rate limit

Server-side authorization check:

subject = authenticated actor
action = requested operation
object = exact resource
context = tenant, ownership, role, risk
decision = allow or deny
evidence = log entry

Tests to include:

  • user A cannot read or modify user B object
  • tenant A cannot enumerate tenant B data
  • read role cannot call write endpoint
  • disabled user cannot use old session
  • admin downgrade revokes privileged access

Session, Token, and Cookie Controls

Cookie baseline:

Attribute Purpose
HttpOnly prevents JavaScript access to session cookie
Secure sends cookie only over HTTPS
SameSite=Lax practical CSRF reduction for most apps
SameSite=Strict stronger but can break cross-site flows
narrow Domain avoids unintended subdomain sharing
narrow Path limits cookie scope

Session controls:

  • rotate session ID after login and privilege elevation
  • expire idle and absolute sessions
  • revoke sessions after password or MFA change
  • store tokens securely on the server or in hardened browser storage
  • avoid long-lived bearer tokens in local storage
  • bind high-risk changes to reauthentication

JWT checks:

# Decode header and payload only; this does not verify signature
cut -d. -f1 token.jwt | base64 -d
cut -d. -f2 token.jwt | base64 -d

JWT review:

Claim/header Check
alg no none; expected algorithm only
iss expected issuer
aud expected audience
exp short lifetime
sub stable subject, not reused for authorization alone
kid cannot be abused for key confusion or path traversal

Input Validation and Injection Defense

Input validation reduces attack surface. Output encoding prevents execution in the wrong context.

Context Primary defense
SQL parameterized queries
NoSQL typed query builders and allowlisted operators
OS command avoid shell; pass arguments as arrays
HTML context-aware output encoding
JavaScript avoid injecting untrusted data into executable context
URL parse, validate scheme and host, then reconstruct
File upload content validation, size limits, storage isolation
Template avoid evaluating untrusted template syntax

Danger signs:

string-concatenated SQL
shell=True
eval()
innerHTML with untrusted data
unsafe deserialization
unvalidated redirect URL
wildcard CORS

Command review examples:

rg -n "eval\\(|innerHTML|shell=True|exec\\(|SELECT .*\\+" .
rg -n "Access-Control-Allow-Origin: \\*" .
rg -n "redirect|returnUrl|next=" .

API Security

API security starts with object and function authorization.

Check What good looks like
Object authorization every object access checks actor, tenant, and action
Function authorization role cannot call unauthorized functions directly
Schema validation reject unknown, malformed, and type-confused input
Rate limits protect login, search, export, invite, OTP, and reset endpoints
Pagination bounded page size and stable cursor rules
Error handling no stack trace, secret, SQL, or internal host leakage
Audit trail actor, action, object, decision, source, request ID

HTTP checks:

curl -i https://api.example.com/v1/me
curl -i -H "Authorization: Bearer <token>" https://api.example.com/v1/users/123
curl -i -X POST -H "Content-Type: application/json" -d '{"role":"admin"}' https://api.example.com/v1/profile

Abuse cases to test:

  • change object ID
  • change tenant ID
  • add unexpected JSON fields
  • replay an old request
  • use read token on write endpoint
  • remove token and check denial

Browser and HTTP Security Headers

Headers do not replace secure design, but they reduce browser-side risk.

Header Baseline
Strict-Transport-Security force HTTPS after first secure visit
Content-Security-Policy restrict scripts, objects, framing, and exfiltration paths
X-Content-Type-Options use nosniff
Referrer-Policy limit referrer leakage
Permissions-Policy disable unused browser features
Cross-Origin-Opener-Policy isolate browsing context where appropriate
Cross-Origin-Resource-Policy restrict cross-origin resource use
Cross-Origin-Embedder-Policy use only when compatible with app needs

Checks:

curl -I https://example.com/
curl -sI https://example.com/ | grep -iE 'strict|content-security|x-content|referrer|permissions|cross-origin'

CSP rollout pattern:

  1. start with Content-Security-Policy-Report-Only
  2. collect violations
  3. remove unsafe inline dependencies
  4. enforce a narrow policy
  5. monitor reports after deployment

Avoid relying on X-XSS-Protection; modern defense is CSP plus output encoding.


CORS and Cross-Site Request Forgery

CORS controls browser reads across origins. It is not an authentication or network firewall.

CORS setting Risk
Access-Control-Allow-Origin: * with sensitive data data exposure
reflect any Origin header origin bypass
Allow-Credentials: true with broad origins credentialed cross-site access
broad methods and headers larger attack surface

CSRF controls:

  • SameSite cookies
  • CSRF token for state-changing requests
  • origin and referer validation
  • reauthentication for sensitive actions
  • no state change through GET

Checks:

curl -i -H "Origin: https://evil.example" https://api.example.com/account
curl -i -X POST -H "Origin: https://evil.example" https://example.com/profile

TLS and Certificate Checks

TLS protects data in transit, but only if certificate, protocol, and hostname behavior are correct.

Inspect remote TLS:

openssl s_client -connect example.com:443 -servername example.com
openssl s_client -connect example.com:443 -servername example.com -showcerts
echo | openssl s_client -connect example.com:443 -servername example.com 2>/dev/null | openssl x509 -noout -subject -issuer -dates

Check versions:

openssl s_client -tls1_2 -connect example.com:443 -servername example.com
openssl s_client -tls1_3 -connect example.com:443 -servername example.com
nmap --script ssl-enum-ciphers -p 443 example.com

Certificate review:

Check Failure mode
hostname in SAN browser or client validation failure
full chain missing intermediate CA
expiry outage or trust failure
private key protection key compromise
SNI behavior wrong certificate for virtual host
weak protocol downgrade or compliance issue

Local certificate:

openssl x509 -in cert.pem -noout -text
openssl x509 -in cert.pem -noout -subject -issuer -dates -ext subjectAltName
openssl pkey -in key.pem -check

Cryptography and Data Protection

Use established libraries and managed key services. Do not design custom cryptography.

Need Good choice
Password storage Argon2id, scrypt, bcrypt, or PBKDF2 where required
Data at rest AES-GCM or platform-managed encryption
Data in transit TLS 1.2 or TLS 1.3
Message integrity HMAC with SHA-256 or stronger
Digital signature Ed25519, ECDSA, or RSA-PSS depending on ecosystem
Randomness cryptographic random generator
Key storage KMS, HSM, vault, or secret manager

Avoid:

  • MD5 and SHA-1 for security
  • ECB mode
  • hardcoded keys
  • nonce reuse
  • homegrown encryption format
  • storing encryption keys beside encrypted data

Hashing vs encryption:

Mechanism Reversible? Use
Hashing no integrity, password verification with slow KDF
HMAC no integrity and authenticity with shared secret
Encryption yes confidentiality
Encoding yes, no secret representation only

Secrets Management

Secrets include passwords, API keys, tokens, private keys, database URLs, webhook secrets, signing keys, and cloud credentials.

Baseline:

Control Good behavior
Storage vault, KMS, HSM, or managed secret store
Access least privilege and audited reads
Rotation planned and tested
Injection runtime environment or sidecar, not source code
Scope separate secrets per environment and service
Revocation documented emergency path

Repo checks:

rg -n "AKIA|BEGIN PRIVATE KEY|password=|SECRET|TOKEN|DATABASE_URL" .
git log -p --all | rg -n "SECRET|TOKEN|PRIVATE KEY|password="

If a secret is committed:

  1. revoke it
  2. rotate dependent systems
  3. remove from history if needed
  4. check logs for use
  5. add detection to CI

Deleting the line is not enough.


Cloud and Infrastructure Security

Cloud controls are split across identity, network, storage, logging, and workload configuration.

Area Baseline
IAM least privilege, MFA for admins, no long-lived root use
Network no public admin ports, explicit ingress, private service paths
Storage block public access, encryption, versioning, access logs
Compute patched images, no exposed metadata credentials, hardened startup
Logging organization-wide audit logs, immutable retention
Secrets managed secret store, no plaintext in user data or repo
Backups encrypted, tested restore, separate access boundary

AWS examples:

aws sts get-caller-identity
aws iam get-account-summary
aws s3api get-public-access-block --account-id <account-id>
aws cloudtrail describe-trails

Kubernetes examples:

kubectl get pods -A -o wide
kubectl auth can-i --list
kubectl get networkpolicies -A
kubectl get secrets -A
kubectl describe pod <pod> -n <namespace>

Red flags:

  • wildcard admin policies
  • public buckets
  • security groups open to 0.0.0.0/0 for admin ports
  • plaintext secrets in environment variables without governance
  • no audit logs
  • no tested restore

Host and Endpoint Security

Host security is useful only when it is observable and repeatable.

Linux checks:

ss -lntup
systemctl list-units --type=service --state=running
systemctl list-timers --all
last -a | head -50
journalctl -p warning..alert --since "24 hours ago"
find / -perm -4000 -type f 2>/dev/null

Patch state:

apt list --upgradable
dnf updateinfo list security
rpm -qa --last | head
grep " install " /var/log/dpkg.log

Endpoint control evidence:

Control Evidence
EDR or AV active agent, healthy sensor, policy assignment
Disk encryption encryption status and recovery key handling
Patch management recent patch report and exception list
Local admin privileged group membership
Logging forwarded security logs
USB/device control policy and exception workflow

Vulnerability and Dependency Management

A vulnerability process needs scope, severity, ownership, due dates, and exception control.

Step Evidence
Inventory assets, applications, containers, dependencies
Scan authenticated scan or SCA result
Triage severity, exploitability, exposure, business context
Ownership named owner and due date
Remediation patch, config change, compensating control
Exception approval, expiry, risk owner
Verification rescan or control evidence

Commands:

nmap -sV -O 203.0.113.10
trivy image example/app:latest
trivy fs .
npm audit
pip-audit
osv-scanner .

Do not treat scanner severity as the final decision. Exposure, exploitability, asset criticality, and compensating controls matter.


Logging, Monitoring, and Alerting

Logs must support investigation without leaking secrets.

Security event baseline:

Event Fields
login success/failure actor, source, device, result, reason
MFA challenge actor, method, result
privileged action actor, role, action, object, decision
access denied actor, object, reason
data export actor, scope, row count, destination
secret access actor, secret ID, environment
admin config change old/new summary, approver, request ID

Do not log:

  • passwords
  • session cookies
  • bearer tokens
  • private keys
  • full payment card numbers
  • unnecessary personal data

Useful checks:

journalctl --since "1 hour ago"
grep -Rni "password\\|token\\|secret\\|authorization" /var/log 2>/dev/null
curl -sS https://example.com/does-not-exist

Incident Response Quick Chain

Incident work is about preserving truth while reducing harm.

  1. Declare severity and owner.
  2. Preserve volatile evidence.
  3. Establish timeline.
  4. Contain without destroying evidence.
  5. Eradicate root cause.
  6. Recover service safely.
  7. Notify required stakeholders.
  8. Capture lessons and control fixes.

Initial evidence:

date -Is
hostnamectl
who
w
ss -lntup
ps aux
last -a | head -50
journalctl --since "24 hours ago" > journal-last-24h.log

Containment options:

Action Risk
disable account may stop active abuse
rotate key may break dependent services
block source IP may be bypassed or harm legitimate users
isolate host preserves state but may interrupt service
snapshot disk useful for forensics
reboot destroys volatile evidence

Do not start with rm, reboot, or blanket firewall flushes unless the risk demands it and the decision is recorded.


Security Review Checklist

Use this before release or major change.

Area Pass condition
Authentication MFA, throttling, recovery, password storage reviewed
Authorization object and function checks tested server-side
Data sensitive data classified, minimized, encrypted where needed
Input validation and output encoding by context
API rate limits, schema validation, and audit logs
Browser HSTS, CSP, cookie flags, CORS, CSRF controls
Secrets no hardcoded secrets, vault or managed store, rotation path
Dependencies inventory, scan, owner, exception expiry
Logging security events captured without secrets
Incident rollback, revoke, restore, notify paths known

Release question:

If this control fails at 2 AM, what evidence proves what happened and who can fix it?

Quick Command Map

Need Command
TLS certificate openssl s_client -connect host:443 -servername host
HTTP headers curl -I https://host
Open ports ss -lntup, nmap -sV host
DNS dig host, dig +trace host
JWT decode `cut -d. -f2 token.jwt
Hash file sha256sum file
Find secrets `rg -n "SECRET
Recent auth logs journalctl _COMM=sshd --since "24 hours ago"
Running services systemctl list-units --type=service --state=running
Security alerts journalctl -p warning..alert --since today

Keep Current

Security guidance changes. Refresh this sheet against primary sources when making policy decisions:

The goal is not to memorize every control.

The goal is to know what to verify, what evidence proves it, and what failure path to prepare before production.