| Learning Objective | Essential Knowledge |
|---|---|
4.1.A |
|
4.1.B |
|
4.1.C |
|
4.1.D |
|
Securing Devices
9:32
Securing Devices
It is Monday morning in a busy hospital. In under a minute, the screens in the ward, the pharmacy and the records office all change. Every file on them is…
English narration · English and 中文 subtitles you can switch
4.1
Device Vulnerabilities and Attacks
Syllabus
Source: College Board AP Course and Exam Description
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.

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.

Name the malware from its behaviour
Each kind of malware has one defining trait: a worm self-spreads, a virus needs a user to run it, ransomware encrypts for money, and a rootkit hides deep in the OS.
| English |
|---|
| embedded computer/emˈbedɪd kəmˈpjuːtə/ |
| Internet of Things (IoT)/ˈɪntənet ɒv θɪŋz/ |
| handheld computers/ˈhændheld kəmˈpjuːtəz/ |
| malware/ˈmælweə/ |
| Virus/ˈvaɪrəs/ |
| Worm/wɜːm/ |
| Trojan/ˈtrəʊdʒn/ |
| remote access trojan (RAT)/rɪˈməʊt ˈækses ˈtrəʊdʒn/ |
| Ransomware/ˈrænsəmweə/ |
| Spyware/ˈspaɪweə/ |
| Keylogger/ˈkiːlɒɡə/ |
| Logic bomb/ˈlɒdʒɪk bɒm/ |
| fileless malware/ˈfaɪlləs ˈmælweə/ |
| RAM/ræm/ |
| unpatched software/ʌnˈpætʃt ˈsɒftweə/ |
4.2
Authentication
Syllabus
| Learning Objective | Essential Knowledge |
|---|---|
4.2.A |
|
4.2.B |
|
4.2.C |
|
4.2.D |
|
Source: College Board AP Course and Exam Description

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.

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 |

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.

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.

How a hash maps any input to a fixed slot
A hash function sends every input to a fixed-length output. The same input always lands in the same place (repeatable), and you cannot work backwards from the slot to the input.
| English |
|---|
| cryptographic hash function/ˌkrɪptəˈɡræfɪk hæʃ ˈfʌŋkʃn/ |
| hash/hæʃ/ |
| collision resistant/kəˈlɪʒn rɪˈzɪstənt/ |
| pre-image resistance/priː ˈɪmɪdʒ rɪˈzɪstəns/ |
| deprecated/ˈdeprɪkeɪtɪd/ |
| salt/sɒlt/ |
| brute force/bruːt fɔːs/ |
| dictionary attack/ˈdɪkʃənəri əˈtæk/ |
| password spraying/ˈpæswɜːd ˈspreɪɪŋ/ |
| credential stuffing/krɪˈdenʃl ˈstʌfɪŋ/ |
| rainbow table/ˈreɪnbəʊ ˈteɪbl/ |
| complexity/kəmˈpleksɪti/ |
| minimum length/ˈmɪnɪməm leŋθ/ |
| maximum age/ˈmæksɪməm eɪdʒ/ |
| password history/ˈpæswɜːd ˈhɪstəri/ |
| lockout/ˈlɒkaʊt/ |
| password manager/ˈpæswɜːd ˈmænɪdʒə/ |
| biometric/ˌbaɪəʊˈmetrɪk/ |
| multifactor authentication (MFA)/ˌmʌltɪˈfæktə ɔːˌθentɪˈkeɪʃn/ |
| autorun/ˌɔːtəʊˈrʌn/ |
4.3
Protecting Devices
Syllabus
| Learning Objective | Essential Knowledge |
|---|---|
4.3.A |
|
4.3.B |
|
4.3.C |
|
4.3.D |
|
Source: College Board AP Course and Exam Description
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.

| English |
|---|
| acceptable use policy/əkˈseptəbl juːs ˈpɒlɪsi/ |
| Anti-malware software/ˈænti ˈmælweə ˈsɒftweə/ |
| patch/pætʃ/ |
| host-based firewall/həʊst beɪst ˈfaɪəwɔːl/ |
4.4
Detecting Attacks on Devices
Syllabus
| Learning Objective | Essential Knowledge |
|---|---|
4.4.A |
|
4.4.B |
|
4.4.C |
|
4.4.D |
|
Source: College Board AP Course and Exam Description
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.

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
dpatelwarrants 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.
| English |
|---|
| indicator of compromise (IoC)/ˈɪndɪkeɪtə ɒv ˈkɒmprəmaɪz/ |
| endpoint detection and response (EDR)/endˈpɔɪnt dɪˈtekʃn ænd rɪˈspɒns/ |
4.4
Exam tips
- 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.
Answers.
- (a) Brute force; (b) password spraying; (c) credential stuffing.
- 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.
What went wrong? Only the site team sees this.
Interactive lessons on this topic
Work through it step by step, with instant-check exercises.