Cyber security basics: 50 cards on attacks, cryptography and defenses
Cyber security flashcards: the CIA triad, phishing, XSS, CSRF, SQL injection, MITM, hashing vs encryption, TLS, MFA, least privilege, OWASP and zero trust.
Practice now
Study without an account
Scheduled with the default Askesis timings. Progress is saved in this browser.
All 50 cards
- 1The CIA triadConfidentiality (only authorized people can read data), Integrity (data isn’t altered undetected) and Availability (systems and data are usable when needed)
- 2Which CIA property does each attack hit: DDoS, a leaked database, a tampered invoice?DDoS: availability. Leaked database: confidentiality. Tampered invoice: integrityRansomware hits availability, and confidentiality too when attackers also steal and threaten to publish data.
- 3Authentication vs authorizationAuthentication verifies who you are; authorization decides what you are allowed to doIn HTTP, 401 Unauthorized actually means “not authenticated”, while 403 Forbidden means authenticated but not allowed.
- 4Vulnerability vs threat vs riskA vulnerability is a weakness; a threat is something that could exploit it; risk is the likelihood of that happening combined with its impact
- 5Principle of least privilegeGive every user, service and process only the permissions it needs, for only as long as it needs them, which limits the damage when an account is compromised
- 6Defense in depthLayering independent controls (network filtering, MFA, patching, encryption, monitoring, backups) so that when one fails, others still protect you
- 7Zero trust“Never trust, always verify”: no user or device is trusted because of its network location; every request is authenticated, authorized and encrypted, with least privilege and an assumption that a breach has already happenedNIST SP 800-207 is the standard reference.
- 8PhishingFraudulent messages that impersonate a trusted sender to trick people into revealing credentials, paying money or running malwareSpear phishing targets specific people, whaling targets executives, smishing uses SMS and vishing uses voice calls.
- 9Red flags of a phishing emailUrgency or threats, a sender or link domain that is slightly off, links whose real target differs from the text, unexpected attachments, and requests for credentials, payment or changed bank details
- 10Brute force vs credential stuffing vs password sprayingBrute force tries many passwords against one account; credential stuffing replays username–password pairs leaked from other sites; password spraying tries a few common passwords against many accounts to avoid lockoutsMFA and blocking known-breached passwords defeat most of these.
- 11Cross-site scripting (XSS)An attacker gets their script to run in other users’ browsers on a trusted site, where it can steal data or act as the userStored XSS is saved on the server (e.g. in a comment), reflected XSS bounces off a request parameter, and DOM-based XSS happens entirely in client-side JavaScript.
- 12Prevent XSS when displaying user input with plain JavaScriptjavascript
// Vulnerable: the input is parsed as HTML el.innerHTML = comment // Safe: the input is shown as text el.textContent = commentFrameworks like React escape output by default; when you must render user HTML, sanitize it with a library such as DOMPurify. - 13Content Security Policy (CSP)A response header that tells the browser which sources of scripts, styles and other resources are allowed, so injected scripts are blocked even if an XSS bug slips throughExample:
Content-Security-Policy: default-src 'self'. Inline scripts are blocked unless allowed with a nonce or hash. - 14Cross-site request forgery (CSRF)A malicious site makes a logged-in user’s browser send an unwanted request, such as a transfer or password change, to a site that trusts the user’s cookies
- 15How do you prevent CSRF?Require an anti-CSRF token on state-changing requests, set session cookies to
SameSite=LaxorStrict, check theOriginheader, and never change state with GET requests - 16Session cookie flags
HttpOnly,SecureandSameSiteHttpOnlyhides the cookie from JavaScript (limiting theft via XSS),Securesends it only over HTTPS, andSameSitelimits sending it on cross-site requests (limiting CSRF) - 17SQL injection, and the fixpython
# Vulnerable: input becomes part of the SQL cur.execute(f"SELECT * FROM users WHERE email = '{email}'") # Safe: a parameterized query cur.execute("SELECT * FROM users WHERE email = %s", (email,))With the vulnerable version, an input like' OR '1'='1changes the query’s logic. Parameterized queries send data separately from the SQL. - 18Man-in-the-middle (MITM) attackAn attacker secretly sits between two parties, reading or altering their traffic, for example through a rogue Wi-Fi hotspot, ARP spoofing or DNS spoofingTLS with proper certificate validation is the main defense.
- 19HSTSHTTP Strict Transport Security: a header (
Strict-Transport-Security: max-age=31536000; includeSubDomains) telling browsers to use only HTTPS for the site, which defeats SSL-stripping attacksSites can join browsers’ HSTS preload list so even the first visit uses HTTPS. - 20Server-side request forgery (SSRF)Tricking a server into making requests to places the attacker can’t reach directly, such as internal services or the cloud metadata endpoint at
169.254.169.254Defenses: allowlist destinations, block internal address ranges, and require IMDSv2 on AWS. - 21Changing
/invoices/1001to/invoices/1002shows someone else’s invoice. What is the flaw?Broken access control, specifically an insecure direct object reference (IDOR): the server doesn’t check that the user owns the objectFix it by checking authorization on the server for every request; hard-to-guess IDs alone aren’t enough. - 22DoS vs DDoSA denial-of-service attack overwhelms a system from one source; a distributed attack uses many sources, often a botnet, which makes it much harder to blockMitigations include CDNs and scrubbing services, rate limiting and autoscaling.
- 23Ransomware, and the best defenseMalware that encrypts (and often steals) data and demands payment. The key defense is offline or immutable backups with tested restores, plus patching, MFA and least privilege
- 24Virus vs worm vs trojanA virus attaches to files and spreads when they run; a worm spreads across networks on its own; a trojan poses as legitimate software to get installed
- 25Zero-day vulnerabilityA flaw the vendor doesn’t know about or hasn’t patched yet, so there is no fix available when attackers start exploiting it
- 26Software supply chain attackCompromising software you depend on, such as a library, build tool or update server, to reach every user of itExamples: SolarWinds (2020) and the xz Utils backdoor (2024). Defenses: lockfiles, dependency scanning, verified signatures and an SBOM.
- 27Hashing vs encryptionHashing is one-way: it turns data into a fixed-size digest that can’t be reversed (integrity checks, password storage). Encryption is two-way: data can be decrypted with the right key (confidentiality)
- 28Is Base64 encryption?No. Base64 is an encoding: anyone can decode it without a key. It only makes binary data safe to transport as text
- 29Properties of a cryptographic hash functionDeterministic, fast to compute, infeasible to reverse (preimage resistance), infeasible to find two inputs with the same hash (collision resistance), and a tiny input change completely changes the outputMD5 and SHA-1 are broken for collision resistance; use SHA-256 or SHA-3 instead.
- 30Why not store passwords as SHA-256 hashes?General-purpose hashes are fast, so attackers can test billions of guesses per second on GPUs. Use a slow, salted password hashing algorithm: Argon2id, scrypt, bcrypt or PBKDF2OWASP recommends Argon2id first.
- 31SaltA unique random value stored next to each password hash, so identical passwords produce different hashes and precomputed rainbow tables are uselessA salt isn’t secret. A pepper is an extra secret value kept outside the database, such as in a secrets manager.
- 32Symmetric encryptionThe same secret key encrypts and decrypts. It is fast, but both sides must somehow share the key securelyExamples: AES (e.g. AES-256-GCM) and ChaCha20-Poly1305.
- 33Asymmetric (public-key) encryptionA key pair: the public key can be shared and is used to encrypt or verify, while the private key stays secret and is used to decrypt or sign. It is much slower than symmetric encryptionExamples: RSA and elliptic-curve algorithms such as X25519 and Ed25519. Post-quantum algorithms such as ML-KEM are being rolled out alongside them.
- 34Bob wants to send Alice a secret message and prove it is from him. Which keys does he use?He encrypts with Alice’s public key, so only her private key can decrypt it, and signs with his own private key, so anyone can verify it with his public key
- 35Digital signatureA value computed over a message’s hash with the signer’s private key; anyone can verify it with the public key, proving integrity and authenticityIt also gives non-repudiation: the signer can’t plausibly deny signing.
- 36How does TLS use both symmetric and asymmetric cryptography?Asymmetric cryptography authenticates the server (its certificate and signature) and runs a key exchange such as ECDHE to agree on shared keys; fast symmetric encryption such as AES-GCM then protects the actual data
- 37TLS certificateA document binding a public key to a domain name, signed by a certificate authority (CA); browsers accept it if it chains up to a root CA in their trust store and is valid for the domainThe maximum lifetime of public TLS certificates is being cut in steps, to 200 days in 2026 and 47 days by 2029, so automated renewal (such as ACME with Let’s Encrypt) is essential.
- 38What did TLS 1.3 change?A faster handshake (one round trip), mandatory forward secrecy, and removal of legacy options such as RSA key exchange, CBC-mode ciphers, RC4 and SHA-1TLS 1.0 and 1.1 are formally deprecated; use TLS 1.2 or 1.3.
- 39Forward secrecyUsing fresh (ephemeral) keys for each session, so stealing the server’s long-term private key later can’t decrypt previously recorded traffic
- 40Is a JWT’s payload secret?No. A standard signed JWT is only Base64URL-encoded, so anyone can read it; the signature prevents tampering, not reading. Don’t put secrets in itAlways verify the signature, expected algorithm, expiry, issuer and audience on the server.
- 41Multi-factor authentication (MFA)Requiring factors of at least two different types: something you know (a password), something you have (a phone or security key) and something you are (a fingerprint)A password plus a security question is still a single factor type.
- 42Rank these MFA methods from weakest to strongest: SMS codes, authenticator app codes, FIDO2 security keysSMS (vulnerable to SIM swapping and interception), then authenticator app TOTP codes (still phishable), then FIDO2/WebAuthn security keys or passkeys, which are phishing-resistantPush approvals can be abused through MFA fatigue: attackers spam prompts until someone taps Approve.
- 43PasskeysFIDO2/WebAuthn credentials that replace passwords with a key pair: the private key stays on your device or password manager, the site stores only the public key, and the credential works only on the real site’s domain, so phishing pages can’t use it
- 44What is the OWASP Top 10, and what is its number one risk?An awareness list of the most critical web application security risks, published by the OWASP Foundation. Broken access control is ranked first in both the 2021 and 2025 editionsOther long-standing categories include injection, cryptographic failures and security misconfiguration. The 2025 edition broadened vulnerable components into software supply chain failures.
- 45Examples of security misconfigurationDefault credentials left in place, verbose error pages with stack traces, publicly readable storage buckets, unnecessary open ports or services, and missing security headers
- 46Network firewall vs web application firewall (WAF)A network firewall filters traffic by IP address, port and protocol; a WAF inspects HTTP requests at layer 7 to block attacks such as SQL injection and XSS patterns
- 47Vulnerability scan vs penetration testA vulnerability scan is an automated search for known weaknesses; a penetration test is an authorized, human-led attempt to exploit weaknesses and show their real impact
- 48CVE vs CVSSA CVE is a unique ID for a publicly disclosed vulnerability, such as CVE-2021-44228 (Log4Shell); CVSS is a 0–10 score of its severityLog4Shell scored the maximum 10.0.
- 49The 3-2-1 backup ruleKeep three copies of your data on two different types of storage, with one copy offsiteAgainst ransomware, make at least one copy offline or immutable and test restores regularly.
- 50You committed an API key to a Git repository. What now?Revoke and rotate the key immediately; deleting it in a new commit isn’t enough because it remains in the history and any clonesThen check the provider’s logs for misuse. Secret scanning (such as GitHub push protection or gitleaks) helps prevent repeats.
Frequently asked questions
Is this deck enough to pass CompTIA Security+?
No single deck is. It drills core concepts that the exam tests, but Security+ also covers governance, risk management and incident response in more depth, so pair it with a full study guide.
Do I need programming experience?
No. A few cards show short code to illustrate XSS and SQL injection fixes, but the explanations stand on their own.
Which OWASP Top 10 edition does it follow?
The cards stick to categories that appear in both the 2021 and 2025 editions, such as broken access control, injection and security misconfiguration, so they stay accurate either way.
More in IT & DevOps
Linux command line
Linux commands and files for sysadmins and LPIC-1 candidates: find and grep, permissions and special bits, fstab, systemd targets, package managers, users, cron and more.
50 cardsLinux filesystem basics
Learn the Linux directory tree: what /etc, /var, /usr, /proc and /dev are for, plus passwd, shadow, fstab and hosts. Free flashcards, no signup.
50 cardsIntermediate Linux filesystem
Linux paths admins use daily: /usr/local, /var/lib, /run, /sys, /etc/skel, sudoers, Bash startup files, SSH keys, resolv.conf and /proc. Free flashcards.
50 cardsAdvanced Linux filesystem
Deeper Linux files for LPIC-1: profile.d, sudoers.d, systemd units, GRUB config, nsswitch.conf, ld.so.conf, distro logs and /lib/modules. Free flashcards.
50 cardsBash scripting
Bash scripting flashcards: shebangs, quoting, exit codes, tests, loops, functions, arrays, parameter expansion, redirection, set -euo pipefail and traps.
50 cardsVim
Learn Vim from the keyboard up: modes, motions, operators and text objects, search and :s substitutions, registers, macros, visual mode and windows.
50 cardsNetworking
Computer networking fundamentals: OSI and TCP/IP layers, TCP vs UDP, common port numbers, subnetting and CIDR, DNS, DHCP and ARP, and IPv6 basics.
50 cardsDocker
Learn Docker from images and layers to multi-stage builds, volumes, networks and Compose, with the commands and best practices you use daily.
50 cardsKubernetes
Kubernetes fundamentals for developers and CKA or CKAD candidates: Pods, Deployments, Services, storage, probes, resources and scheduling, plus the kubectl commands you use daily.
50 cardsAWS
AWS flashcards: regions and AZs, EC2, S3 storage classes, IAM users, roles and policies, VPC networking, RDS, Lambda, CloudWatch and Route 53.
50 cardsTerraform
Terraform flashcards: HCL, providers, resources, variables and outputs, state and remote backends, plan and apply, modules, count, for_each, drift and import.
50 cards