AP Cybersecurity · Study guide

Detecting Attacks on Data

AP® Cybersecurity · Unit 5 · Applications, Data & Cryptography

Detecting Attacks on Data

How access logs, honeypot files, and file hashes reveal when an adversary reads, copies, moves, deletes, or changes data.

1Watching the data itself

An adversary who gets past the network and device defenses still has to touch the data to steal, change, or destroy it. Three detection methods watch for that.

Figure 1. Logs show who did what, a honeypot turns any touch into an alarm, and a hash proves whether the contents changed.

2Accounting: access logs

Devices track and log when data are accessed and by whom. Recording and monitoring user activity is called accounting. Analyzing these logs can reveal an adversary trying to access, copy, move, or delete data. Suspicious activity includes:

  • Accessing files that are not usually accessed.
  • Accessing files or applications outside a user's normal patterns of time of day, location, or device type.
  • Attempts to delete or copy sensitive files.
File-access log for one day
09:14  mreyes  LAPTOP-114  OPEN    Sales/q3_forecast.xlsx
10:02  jkwan   LAPTOP-207  OPEN    HR/benefits.pdf
11:47  mreyes  LAPTOP-114  OPEN    Sales/leads.csv
02:31  jkwan   UNKNOWN-PC  OPEN    HR/salaries.xlsx
02:33  jkwan   UNKNOWN-PC  COPY    HR/salaries.xlsx
02:36  jkwan   UNKNOWN-PC  OPEN    Finance/card_numbers_2026.xlsx
14:20  mreyes  LAPTOP-114  DELETE  Finance/payroll.csv

A simple program that compares each line with each user's normal files, hours, and device flags 4 of the 7 lines:

When and whoActionWhy it was flagged
02:31 jkwanOPEN HR/salaries.xlsxfile this user does not normally open; outside normal hours; unfamiliar device
02:33 jkwanCOPY HR/salaries.xlsxfile this user does not normally open; outside normal hours; unfamiliar device; copy of a sensitive file
02:36 jkwanOPEN Finance/card_numbers_2026.xlsxhoneypot touched; outside normal hours; unfamiliar device
14:20 mreyesDELETE Finance/payroll.csvfile this user does not normally open; delete of a sensitive file

The 02:31 to 02:36 run is one story: someone using jkwan's account on an unknown computer in the middle of the night opened salary data, copied it, then opened a file that looked like card numbers. The 14:20 deletion came from mreyes's normal laptop during work hours, but deleting payroll data is still worth asking about.

3Honeypot files

A honeypot is a file that appears to contain valuable data (credit card numbers, PII, passwords), but the data are fake. The system alerts defenders if anyone tries to access it. Because the file is fake, there is no legitimate reason to open it, so any access is an indicator of malicious activity. In the log above, Finance/card_numbers_2026.xlsx is a honeypot; the 02:36 access needs no further analysis to be suspicious.

4Hashes reveal changes

A cryptographic hash function produces a digest of a file. The same input always gives the same digest, and any change, even one character, gives a completely different one. A file that changes unexpectedly can be a sign of malicious activity.

Payroll fileSHA-256 digest (first 16 characters)
Recorded Mondaycc926c41a1de6004…
Checked Tuesday, unchangedcc926c41a1de6004…
Checked Friday, one digit of an account number changed3ccfb91507755291…

Friday's digest does not match, so the file was altered after Tuesday's check. Someone changed R. Diaz's account number from 7730-1906 to 7730-1909, which could redirect a paycheck.

The key idea

Access logs (accounting) reveal unusual access, copying, or deletion; a honeypot file turns any access into an alert; and comparing hash digests reveals altered data.

5Worked examples

Worked Example 1 Read the log

The night shift

A log shows the user tbell, who normally works 9 to 5 on a desktop in the Chicago office, opening customer records at 3:10 AM from a phone in another country. Is this suspicious, and which indicators apply?

  1. 1
    Time of day: 3:10 AM is outside the normal pattern.
  2. 2
    Location: another country instead of the office.
  3. 3
    Device type: a phone instead of the usual desktop.
Answer: Yes. Three departures from the user's normal pattern suggest a compromised account.
Worked Example 2 Use a honeypot

Bait for an insider

A company suspects someone is browsing files they shouldn't. It creates Exec/layoff_list_2027.xlsx filled with invented names and sets an alert on it. A week later, the alert fires for an intern's account. What does this show?

  1. 1
    The file is fake, so no one has a work reason to open it.
  2. 2
    Any access is an indicator of malicious activity.
  3. 3
    The intern's account (or whoever controls it) was searching for sensitive data.
Answer: The honeypot detected snooping. Investigate the intern's account.
Worked Example 3 Check a hash

The website file

An admin recorded the SHA-256 digest of login.php at deployment. Today's digest is different, but no one on the team made a change. What does it mean?

  1. 1
    Same input always gives the same digest.
  2. 2
    A different digest means the file's contents changed.
  3. 3
    No authorized change was made, so an adversary may have modified the login page.
Answer: The file was altered without authorization: treat it as a possible attack.
Worked Example 4 Choose the method

Which would catch it?

Which method (logs, honeypot, or hash) best detects each: (a) a nurse's account copying 5,000 patient records at night; (b) an attacker who searches the file server for anything named “passwords”; (c) a changed grade in a stored transcript file?

  1. 1
    (a) Copying sensitive files at an unusual time shows up in access logs.
  2. 2
    (b) A honeypot named like a password file would attract the search.
  3. 3
    (c) A changed file changes its hash digest.
Answer: (a) logs, (b) honeypot, (c) hash.

6Common mistakes

Common Mistake 1 · Looking only at failed access

Successful access at an odd time, from an odd place or device, is often the clearest sign.

Common Mistake 2 · Expecting hashes to catch theft

A hash shows whether data changed. Someone who only reads or copies a file leaves its hash the same.

Common Mistake 3 · Thinking a honeypot needs analysis

No one has a reason to open it, so any access is suspicious on its own.

Report a data-attack indicator like this

“At 02:31, jkwan’s account opened and then copied HR/salaries.xlsx from an unknown device, outside the user’s normal hours, and three minutes later opened the honeypot file. These indicate an adversary using a compromised account to find and copy sensitive data.”

Quote the log entries, name the indicators (time, device, file, action), and state what they suggest.