Why it matters. On 21 October 2016, many of the most popular websites in the United States, including Twitter, Netflix and Reddit, became unreachable for hours. The attack came from the Mirai botnet: hundreds of thousands of internet cameras, video recorders and home routers that still used their factory usernames and passwords. Mirai's code simply tried a list of about sixty default logins, took over every device that accepted one, and used them all to flood the DNS company Dyn with traffic. No clever exploit was needed - just devices nobody had secured. This unit is about how devices are attacked, and how to protect and monitor them.
Mirai, October 2016: default passwords turned home devices into a botnet
A device is any computer - a server, a personal laptop, a smartphone, or an embedded computer 嵌入式计算机 built into a machine. Network-connected everyday devices with embedded sensors or actuators are called Internet of Things (IoT) 物联网 devices, and they run everything from water pumps to washing machines.
The four classes of device, and why the class matters
Class
What it is
Security consequence
servers
shared machines running services for many users
the highest-value target; one compromise reaches everyone
personal computers
desktops and laptops
general purpose, so they run anything the user installs
handheld computers 手持计算机 (also called mobile computers or information appliances)
smaller than a PC and running on battery power — smartphones, tablets, smart watches and other wearable technology
easily lost or stolen, and often carried across untrusted networks
embedded computers
a computer that is part of a machine — a car's engine controller, a thermostat, a medical pump
performs specialised tasks, often using a general-purpose instruction set, and tends to be slower, cheaper and to have minimal storage, so security features are often left out and updates are rare
That last row is the reason embedded and IoT devices appear so often in attack scenarios: the constraints that make them cheap are the same constraints that make them hard to defend.
The main threat to a device is malware 恶意软件 - malicious software. Learn the types:
Virus 病毒 - attaches to a host file or program and runs when that host executes; opening an infected file is one possible trigger.
Worm 蠕虫 - spreads by itself, with no human action.
Trojan 木马 - hides inside software that looks safe; a remote access trojan (RAT) 远程访问木马 gives the adversary remote control.
Ransomware 勒索软件 - encrypts your files and demands payment for the key.
Spyware 间谍软件 - secretly tracks what you do.
Keylogger 键盘记录器 - records every keystroke to steal passwords.
Logic bomb 逻辑炸弹 - triggers only when a condition is met (a date, a version).
Rootkit - deeply hides in the operating system and can even make itself invisible.
Most malware is a file, but fileless malware 无文件恶意软件 is different: it often runs in RAM 内存 and abuses legitimate programs already on the device instead of a standalone malicious executable. It can leave traces or persist in settings such as the registry; memory and behaviour monitoring can still detect it.
Adversaries exploit unpatched software 未打补丁的软件, weak passwords, unprotected BIOS/UEFI startup settings, and open ports. We rate device risk by the value and criticality of the device - a hospital's unpatched email server is high risk, while an employee's laptop with one unused open port is low.
Common device vulnerabilities and the attacks that use them
Multi-factor authenticationA fingerprint scanner: biometric authentication checks something you ARE, which is much harder for an attacker to steal or guess than a password
To store passwords safely, systems use a cryptographic hash function 密码散列函数 - a one-way maths algorithm that turns any input into a fixed-length string called a hash 散列值 (or digest). Hashes have three vital properties: they are collision resistant 抗碰撞 (hard to find two inputs with the same output), have pre-image resistance 抗原像 (recovering an input from a hash is computationally infeasible in general, although weak passwords can be guessed), and are repeatable (the same input always gives the same hash).
Try it — read real hash results. These inputs use UTF-8 with no final newline. Only the first 16 of each full SHA-256 hash's 64 hex characters are displayed.
Input
Hash prefix
Full hex length
cat
77af778b51abd4a3
64
cat again
77af778b51abd4a3
64
cats
d936608baaacc6b7
64
Which rows illustrate repeatability? What stays fixed when input length changes? Do these results prove that collisions are impossible?
Worked reasoning. The two identical cat inputs give the same full hash. Both cat and cats have outputs of 64 hex characters. Each hex character represents 4 bits:
The changed output for cats illustrates sensitivity to an input change; three examples do not prove collision resistance. Matching prefixes alone do not establish that full hashes match. The full outputs in this worked example were checked.
Why collisions exist. An $n$-bit output has $N = 2^n$ possible values. A toy 4-bit hash has $N = 2^n = 2^4 = 16$ outputs. With 17 different inputs, at least two must share an output. This toy is not secure. Real cryptographic hashes have much larger output spaces, but collisions still exist; the goal is to make finding them computationally infeasible.
Schematic: the digest labels are illustrative, not computed SHA-256 values. There is no direct decryption step; guesses can still be hashed and compared.
Real hash functions have names. The Secure Hash Algorithm (SHA) family – SHA-256 and SHA-512 – is today's standard. Adversaries attack a hash function by trying to force a collision (two different inputs with the same hash); once an efficient collision attack exists, that function is deprecated 弃用 (retired from secure use). MD5 and SHA-1 are the classic deprecated examples – never rely on them to protect data today.
A secure service should not store your plaintext password. It stores a salted password hash; when you log in, it hashes what you typed and compares. To stop two identical passwords producing identical hashes, a few random bits called salt 盐值 are added before hashing, so identical passwords do not normally produce identical stored hashes. Salt is stored with the hash and does not need to be secret.
Worked example. Two users both choose the password sunshine. Without salt, both stored hashes would be identical, so cracking one instantly cracks the other. Give each user a unique random salt - shortened here to x7 and q2 for readability - and the service hashes sunshinex7 and sunshineq2 instead. The two stored hashes now look completely different, so the adversary must attack each account separately. Salt prevents reuse of one unsalted lookup table across accounts, but does not make a weak password strong. This simple concatenation illustrates the idea; real password storage uses a purpose-built slow password-hashing scheme with a suitably sized unique random salt, not raw SHA-256.
Transfer — one-way does not mean unguessable. A stolen record has salt x7 and a SHA-256 hash. Its displayed prefix is f9325402a7a1542a. An adversary guesses rainbow and sunshine, appends the salt, hashes the results, and compares them with the record. The rainbowx7 prefix is 2a0e6ce47f2c701d; sunshinex7 begins f9325402a7a1542a. Which guess should be checked in full? Was the hash decrypted? Would live account lockout stop these computations?
Worked answer. The sunshine guess should be checked in full because its displayed prefix matches. The prefix alone cannot establish a full match; the rainbow prefix already rules that guess out. This is guessing, hashing and comparing, not decryption. A known salt does not prevent guessing a weak password. Account lockout controls live login attempts; it does not stop computations on a stolen database. The guesses generate no login events at the service, although database theft or later use of the credentials may leave evidence.
Adversaries fight back with password attacks. Online attacks submit credentials to a live login; offline attacks steal the hash database and crack it on their own machine (which bypasses any account-lockout protection). Techniques include:
brute force 暴力破解 - an automated tool tests all candidates in a chosen search space. Exhaustive search finds a match if the space includes the password and every candidate can be tested, but the cost may be impractical. For length $L$ with $A$ choices per position, the candidate count is $N = A^L$. Real attacks often try likely choices first.
a dictionary attack 字典攻击 - the tool tries a list of common words and known passwords first, because most people pick guessable ones.
password spraying 密码喷洒 - one common password against many accounts (this dodges lockout, which counts failures per account).
credential stuffing 撞库 - reusing stolen or default credentials, exploiting that people reuse passwords across sites.
a rainbow table 彩虹表 - precomputed chains of hash and reduction operations that trade storage for recovery work on supported unsalted password candidates; it is not simply a complete list of every password and hash.
Password policy settings
The course names several login-policy settings. Describe their mechanisms on an exam without assuming that enabling every setting is current best practice:
Setting
What it does
The attack it slows
complexity 复杂度
require a character from each set (upper, lower, digit, special)
brute force / dictionary
minimum length 最小长度
require N characters - length matters more than anything
brute force (grows exponentially)
maximum age 最长有效期
sets a time limit after which a password must change; a policy mechanism, not a universal recommendation
limits how long a stolen password is useful
password history 密码历史
store the last 5-10 hashes, block reuse
stops recycling an old (possibly leaked) password
lockout 锁定
lock the account after 3-5 wrong tries
brute force / online guessing
Length beats complexity: each added character multiplies the search space
Distinguish a setting from a recommendation. NIST SP 800-63B-4 says not to require periodic password changes or character-class composition rules. Change a password when compromise is suspected or known, and block common/compromised choices. Routine expiry can encourage predictable patterns like PasswordFall2028. A password manager 密码管理器 solves the real problem - it generates and stores a long, unique password per site, so none is ever reused or guessable.
Authentication factors fall into categories: something you know (a password), something you have (a token), or something you are (a biometric 生物特征). Multifactor authentication (MFA) 多因素身份验证 combines distinct factor categories. The course also discusses location (“somewhere you are”); under NIST, location is context for assessing risk, not a substitute for an independent authentication factor.
A hardware security key proves who you are with something you physically hold — a strong second factor
Removable media, and the autorun problem
An adversary can load malware onto an external drive — a USB stick, a portable disc — and leave it where someone will pick it up. If autorun 自动运行 is enabled, the device runs a program from that drive the moment it is inserted, with no click required, so the malware executes before the user has decided to trust anything.
Two controls answer this, and the exam wants both named:
Disable autorun, so inserting a drive never runs anything by itself.
Prohibit users from connecting external drives or media at all — enforced by policy and by a technical control that blocks the USB ports — which is why so many secure environments physically or logically disable them.
Each of the two controls breaks a different link in the chain
4.3.D.4 基于主机的防火墙规则可以根据源或目的端口或 IP 地址、服务、协议或应用程序来允许或拒绝流量。
来源:College Board AP 课程与考试说明
English
Managerial controls set the rules: an acceptable use policy 可接受使用政策 lists what users may and may not do, a password policy sets length and reuse rules, and a software installation policy controls what can be installed.
Technical controls do the work. Anti-malware software 反恶意软件 keeps a database of malware signatures and quarantines any file that matches. Keeping the operating system and applications updated - installing each patch 补丁 - closes known holes before adversaries can use them. A host-based firewall 主机防火墙 controls traffic in and out of one single device, blocking ports and services it does not need.
Anti-malware software scans files against a signature database and quarantines any matches — this scan has flagged two threats
4.4.D.2 如果授权用户从不同于预期的位置或 IP 地址登录,或在不同于正常的时间登录,这可能是用户密码被盗用的指标。
4.4.D.3 密码喷洒的指标是多个用户在极短的时间间隔内从同一个 IP 地址或异常 IP 地址尝试登录。
4.4.D.4 凭证填充的指标是一系列默认的用户:密码组合在短时间内连续尝试登录同一台设备,通常来自同一个 IP 地址。
4.4.D.5 离线密码攻击无法被检测到,因为攻击发生在敌对者的计算机上。
来源:College Board AP 课程与考试说明
English
Devices log logins, file changes, and processes, and these logs reveal an indicator of compromise (IoC) 入侵指标 - evidence suggesting possible intrusion, to investigate in context. Host-based IoCs show up as unexpected processes or changed settings; file-based IoCs are files whose hash matches known malware; behaviour-based IoCs are things like many failed logins or unusual login times.
Choosing a detection method means weighing performance (signature-based is lighter, better for weak devices), cost (an endpoint detection and response (EDR) 端点检测与响应 service is powerful but expensive), and how sensitive the device is. Reading authentication logs exposes password attacks: many wrong passwords for one user signals a guessing attack; many users failing in quick succession is an indicator of password spraying; the AP course document also treats rapid default-credential attempts as an indicator of credential stuffing. These patterns need context; one shared IP address does not by itself prove an attack. Offline guesses create no live login events because they run on the adversary's copy; the theft or later use of the credentials may still be detected.
Speed is itself a security factor.Signature-based detection compares what it sees against a list of known-bad patterns, so it is often cheaper to run than anomaly-based detection, which compares events with a learned model of normal behaviour. Anomaly-based detection can catch attacks that have no signature yet, but may need more processing power; actual costs depend on the implementation and workload — and on a device that lacks it, the effect compounds: the detection runs slowly, the device degrades, and the method ends up not being implemented effectively at all.
Signs of a compromised device
Worked example: reading an authentication log. Two excerpts from a school server's log:
Time
User
Source IP
Result
02:14:01
mchen
203.0.113.7
failed
02:14:02
mchen
203.0.113.7
failed
02:14:03
mchen
203.0.113.7
failed
… 200 more in 4 minutes …
mchen
203.0.113.7
failed
Time
User
Source IP
Result
03:00:10
adiaz
198.51.100.20
failed
03:00:40
bkumar
198.51.100.20
failed
03:01:10
cliu
198.51.100.20
failed
03:01:40
dpatel
198.51.100.20
success
Log 1 suggests a brute-force or dictionary attack on one account: hundreds of failures, one user, one source, seconds apart at an unusual hour. Investigate the source and account activity. Account lockout can limit online guesses, and the source IP can be blocked.
Log 2 is consistent with password spraying: attempts span several accounts without repeated failures on one account. The log does not show the passwords, so it cannot establish that one common password was used; credential stuffing is another possibility. The success on dpatel warrants checking with the user and reviewing later activity. Contain suspected compromise by disabling access or revoking sessions and resetting credentials. MFA can block password-only access; blocking common passwords reduces spraying risk.
The pattern to look for is what repeats: the same user (brute force), the same source across many users (spraying), or a success right after a run of failures.
Know each malware type by its defining trait: a worm self-spreads, a virus attaches to a host and runs when the host executes, ransomware encrypts for money, a RAT gives remote control, a rootkit hides.
A hash is one-way and fixed-length; a unique salt changes the hashed input even when passwords match. A secure service should store a salted password hash, using a purpose-built slow scheme rather than raw SHA-256.
Name real algorithms: SHA-256/SHA-512 are current; MD5 and SHA-1 are deprecated because efficient collision attacks exist.
Match the password attack to its log signature: cite failed-login entries, timing and users. These are indicators, not proof. The AP CED includes default-credential attempts under stuffing.
Recognise the course’s know / have / are / where labels, while distinguishing location context from an independent NIST authentication factor. MFA combines distinct factors, not two passwords.
Offline guessing creates no live login events: the computations happen on the adversary's copy. Theft or later account use may still leave evidence.
Course terminology and implementation boundary. The AP CED 4.2.B.5 includes default-credential attempts under credential stuffing. OWASP's narrower definition focuses on replaying stolen username/password pairs across services. Use the AP definition for AP questions, while identifying the actual evidence and mechanism. The course's named general-purpose hashes illustrate hashing; they are not a recommendation to store passwords with plain SHA-256. See OWASP password-storage guidance and NIST hash properties.
Common mistakes.
Calling every malicious program a virus. Name the type by its trait: a worm spreads by itself; a virus needs a host program to run.
Thinking hashing is encryption. A hash cannot be reversed with a key; it is checked by hashing the guess again.
Treating a password and a security question as two factors. Both are something you know, so it is still one factor.
Assuming signature-based detection catches new attacks. It only matches known patterns.
Leaving default credentials or skipping patches because a device “only” controls a camera or a thermostat.
Practice.
Name the attack shown by each log pattern: (a) 500 failed logins to one account from one IP address in two minutes; (b) one failed login each to 300 accounts, all with the password Spring2024!; (c) many accounts tried once each with username-password pairs leaked from another site.
Explain why a unique salt for each user defeats a rainbow table.
Classify each authentication factor: a PIN, a code from an authenticator app on a phone, a fingerprint.
An attack uses a vulnerability no vendor knows about yet. Which kind of detection is more likely to notice it - signature-based or anomaly-based? Explain.
A toy hash has 4-bit outputs. Explain why any 17 different inputs must include a collision.
Give two steps that would have stopped Mirai from taking over a home camera.
A rainbow table is precomputed for unsalted inputs. A unique random salt changes every input, so the attacker would need a new table for every salt, which is not practical.
Something you know; something you have; something you are.
Anomaly-based, because it flags behaviour that differs from normal; signature-based needs a known pattern, which does not exist yet for a new attack.
There are only $2^4 = 16$ possible outputs, so with 17 inputs at least two must share an output (the pigeonhole principle).
Change the default password to a strong unique one, and install firmware updates (patches); also block remote login from the internet if not needed.