Data-hiding techniques and remote acquisition
Notes on data-hiding techniques (steganography, watermarking, covert channels) and methods for remote acquisition of digital evidence, with definitions, formulas, worked examples, common exam mistakes and short self-check questions.
Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.
Why it matters
Two common needs in cyber security and digital forensics are (1) detecting and recovering data that an attacker or suspect has hidden inside files or network flows, and (2) acquiring a forensic-quality copy of data over a network (remote acquisition) while preserving integrity and chain of custody. Engineers use these skills when analysing malware that uses steganography, when proving data tampering, and when collecting evidence from remote systems or cloud storage.
Key ideas
(Definitions are bold and given before use.)
Steganography — the practice of hiding a secret message or data inside another innocuous file (called the cover). The secret is hidden so that others do not suspect its existence. Assumption: cover file format supports modifications without obvious corruption (e.g., images, audio).
Watermarking — embedding an identifier (owner, copyright, or integrity mark) into a media file such that the mark is detectable or extractable even after some allowed transformations (e.g., scaling, compression). Watermarking often targets robustness rather than secrecy.
Covert channel — any communication channel used to transfer information in a manner that violates a system’s security policy. Example: encoding data in TCP/IP header fields or timing of packets. Assumption: attacker can control the feature used (e.g., packet timing or unused header bits). Covert channels are commonly categorized as storage channels (data hidden in fields/state) and timing channels (data encoded in event timing).
Cover and Stego: the cover is the original carrier file; the stego (steganographic) file is the cover after embedding the secret payload.
Payload — the actual secret data embedded; Capacity — the maximum amount of secret data that can be embedded into a cover without producing suspicious distortion. Both are measured in bits or bytes.
Distortion — the measurable change between cover and stego. For images, a typical objective measure is MSE (Mean Squared Error) and PSNR (Peak Signal-to-Noise Ratio). Lower distortion means less perceptible change.
Least Significant Bit (LSB) embedding — a simple spatial-domain steganographic method that replaces the least significant bit(s) of pixels or samples with payload bits. Assumption: modifying LSBs causes low perceptual change but is fragile to transformations like compression. Basic LSB steganalysis methods include chi-square, RS analysis, and sample pair analysis.
Transform-domain methods — embedding is done on transform coefficients (e.g., DCT coefficients in JPEG, DWT coefficients in wavelet-based formats). These are usually more robust to compression and some image processing.
Hash function — a deterministic function that maps data of arbitrary size to a fixed-size string called a digest. Properties relevant to forensics:
- Preimage resistance: given digest h, it is computationally infeasible to find input x with hash(x)=h.
- Second-preimage resistance: given x and hash(x), it is hard to find y≠x with hash(y)=hash(x).
- Collision resistance: it is hard to find any pair x≠y with the same hash. For forensic integrity, use collision-resistant hashes (e.g., SHA-256) because MD5 and SHA-1 have known collisions.
Remote acquisition — creating a forensic-grade copy of a disk or file set across a network link. Key goals: preserve bit-for-bit integrity, collect metadata (timestamps, file attributes), maintain a verifiable chain of custody, and minimize disturbance to the source system (especially if live acquisition is required). Techniques include using read-only agents, filesystem/volume snapshots (e.g., LVM/ZFS or cloud snapshots), and cryptographic hashing during acquisition.
Live acquisition vs. Offline acquisition: Live acquisition collects data while the system is running (captures volatile data: RAM, network connections). Offline acquisition occurs when the target disk is seized and imaged while powered off (captures non-volatile storage without live-state changes). Remote acquisition is often a form of live acquisition.
Exact statements useful in answers (model-theorem style):
Definition (forensic image): "A forensic image is a bit-for-bit copy of a storage medium, captured so that every bit in the original is represented in the copy, together with secure cryptographic checksums (hashes) that allow verification, including allocated and unallocated areas (e.g., slack and free space)." Assumption: imaging tool does not alter original; if it must, changes are logged.
Integrity verification rule: "If H is a collision-resistant hash function and H(original) == H(image), then with high confidence the image is an exact copy of original, assuming the hash algorithm and implementation are trusted and no hardware errors occurred."
Diagrams to draw (describe exactly):
LSB embedding diagram: draw a 3-column table with headings: "Pixel (decimal)", "Pixel (binary 8-bit)", "LSB after embedding". For each pixel row, show original 8-bit binary, underline the original LSB, write the message bit below, and show the new binary and new decimal value. Label columns and note "message bits flow left-to-right".
Remote acquisition flow diagram: draw ordered boxes: "Target system (source)" -> "Network" -> "Acquisition host (destination)". Annotate arrows with "encrypted channel (SSH/TLS)" and side-note boxes: "compute H_src = hash(source) during read (or prior if feasible)", "compute H_img = hash(received image)" after transfer, and a small box for "chain-of-custody log" listing operator, timestamp, command, and hashes.
Formulas
Time = Size / Bandwidth
- Size: total data size to transfer (bytes) or (bits). Bandwidth: network throughput (bytes per second or bits per second). Use consistent units.
- Applies to ideal transfer ignoring protocol overhead, retransmissions and latency. SI unit: seconds (s) for Time, bytes (B) or bits (b) for Size, B/s or b/s for Bandwidth.
Bits = Bytes × 8
- Converts storage bytes to bits. SI units: bits (b), bytes (B).
MSE = (1/(M·N)) · Σ_{i=1..M} Σ_{j=1..N} [I(i,j) - K(i,j)]^2
- I and K are cover and stego image pixel values; M×N is image size. Units: (intensity unit)^2. Assumption: same dimensions and alignment.
PSNR = 10 · log10 (MAX^2 / MSE)
- MAX is maximum possible pixel value (e.g., 255 for 8-bit images). Units: decibels (dB). Higher PSNR means less distortion.
Capacity_LSB = Number_of_pixels × LSBs_per_pixel
- Capacity in bits for simple spatial LSB embedding. Applies to uncompressed or lossless-cover formats. For multi-channel images (e.g., RGB), multiply by the number of channels used.
Hash notation (no arithmetic formula):
h = H(data)
- H is a hash function (e.g., SHA-256), h is the digest. Unitless string usually shown in hex. Use for integrity verification.
Worked examples
- LSB embedding and capacity (numerical, step-by-step) Problem: You have a grayscale 8-bit image, 100 × 100 pixels. You want to hide the ASCII message "Hi" (characters H and i) using 1 LSB per pixel. Show capacity and embed a 16-bit example into the first 8 pixels with given pixel values. Steps:
- Compute capacity: Number_of_pixels = 100 × 100 = 10,000 pixels.
Capacity_LSB = 10,000 pixels × 1 bit/pixel = 10,000 bits. Convert to bytes:10,000 bits / 8 = 1,250 bytes(≈ 1.25 kB, decimal; ≈ 1.22 KiB, binary). So a 2-byte message ("Hi" = 2 bytes = 16 bits) easily fits. - Convert message to bits: ASCII 'H' = 0x48 = 01001000, 'i' = 0x69 = 01101001. Full bit stream: 01001000 01101001 (16 bits).
- Given first 8 pixel decimal values: [200, 201, 150, 151, 100, 101, 255, 254]. Show embedding for first 8 bits (first byte 01001000):
- Draw table as instructed in Key ideas. We perform per-pixel LSB replacement: Pixel 1: 200 = 11001000 (LSB=0). Message bit=0 → new LSB=0 → stego pixel stays 200. Pixel 2: 201 = 11001001 (LSB=1). Message bit=1 → stays 201. Pixel 3: 150 = 10010110 (LSB=0). Message bit=0 → stays 150. Pixel 4: 151 = 10010111 (LSB=1). Message bit=0 → change LSB to 0: new binary 10010110 = 150. Pixel 5: 100 = 01100100 (LSB=0). Message bit=1 → change to 01100101 = 101. Pixel 6: 101 = 01100101 (LSB=1). Message bit=0 → change to 01100100 = 100. Pixel 7: 255 = 11111111 (LSB=1). Message bit=0 → change to 11111110 = 254. Pixel 8: 254 = 11111110 (LSB=0). Message bit=0 → stays 254.
- Resulting stego values for these 8 pixels: [200, 201, 150, 150, 101, 100, 254, 254]. Recovery: read LSBs of stego pixels in order to rebuild bit stream and map to ASCII. Final check: The message bits are recovered exactly if the stego image is not modified after embedding. Bold answer: The image capacity is 10,000 bits (1,250 bytes) and the example first-8-pixel stego values are 200, 201, 150, 150, 101, 100, 254, 254.
- Remote acquisition time and integrity verification (network numeric + hash steps) Problem: Acquire a 500 GB disk image from a remote machine over a 100 Mbps network link. Show the ideal transfer time calculation and the integrity verification steps using SHA-256. Steps:
- Choose unit convention (state explicitly): take 1 GB = 10^9 bytes (verify in exam if they use GiB). So Size = 500 × 10^9 bytes.
- Convert to bits:
Bits = 500 × 10^9 bytes × 8 = 4.0 × 10^12 bits. - Bandwidth in bits per second: 100 Mbps = 100 × 10^6 bits/s = 1.0 × 10^8 bits/s.
- Compute time:
Time = Bits / Bandwidth = 4.0 × 10^12 / 1.0 × 10^8 = 4.0 × 10^4 s. - Convert seconds to hours:
4.0 × 10^4 s / 3600 ≈ 11.11 hours.- Note: This is ideal time. Real transfer will be longer due to protocol overhead, encryption, disk read speed and retransmissions.
- Integrity verification protocol (steps to state in answer):
- On source: compute
h_src = H(device)using SHA-256 on the raw device or file; record hash and timestamp in chain-of-custody log. - Transfer image over an encrypted channel (e.g., SSH or TLS) to destination while logging operator identity and commands executed.
- On destination: compute
h_img = H(received_image)using the same hash function. - Verify
h_src == h_img. If equal, we have high confidence of exact copy (with caveats about hash collision and hardware errors). - Store both hashes in evidence records and, if possible, repeat hashing at different layers (e.g., per-chunk hashing) to detect in-transit corruption.
Example numbers (hypothetical):
h_src = 3a7f...e9b1and after transferh_img = 3a7f...e9b1. If equal, acquisition succeeded. Bold answer: Ideal transfer time is ≈ 11.11 hours and verification requires SHA-256 agreement between source and destination.
- On source: compute
Common mistakes
- Using MD5 alone for integrity in high-stakes cases; MD5 collisions are known. Prefer SHA-256 and record hash algorithm and tool versions.
- Modifying original evidence during acquisition (e.g., mounting a filesystem read-write). Always mount read-only or use tools that do not alter timestamps/metadata and log any unavoidable changes.
- Assuming LSB embedding is invisible in all formats: compressed formats (JPEG) will destroy naive LSB stego in spatial domain; use transform-domain methods for robustness.
- Not preserving or recording metadata (file timestamps, system logs) during remote acquisition — these are often useful evidence.
For your exam
Kinds of questions you will get:
- Definitions (define steganography, watermarking, covert channel, forensic image).
- Short notes (LSB embedding, transform-domain steganography, remote acquisition steps).
- Derivations/estimations (compute capacity, compute transfer time; show MSE/PSNR derivation for a small example).
- Procedure questions (step-by-step remote acquisition plan with integrity checks and chain-of-custody items to record).
- Diagram questions (draw and explain LSB embedding table; draw flow of remote acquisition with hash verification).
What a full-marks answer includes:
- Clear definitions of bolded terms, assumptions stated (e.g., cover format type, 1 LSB per pixel), and step-by-step derivations (show unit conversions for time and capacity).
- For procedures: list exact commands or tool types in order (e.g., compute hash on source, transfer using encrypted channel, compute hash on destination) and details to record in chain-of-custody.
- Numerical answers must show all unit conversions and a final numeric value with units and a short discussion of practical caveats.
Quick check
- What is the capacity in bytes of a 200 × 200 8-bit image using 1 LSB per pixel?
- If a 250 GB disk is sent over a 1 Gbps link, what is the ideal transfer time in hours? Use 1 GB = 10^9 bytes.
- Name two properties of a cryptographic hash useful in forensic integrity verification. Answers: Capacity = 200×200 bits / 8 = 40,000 bits / 8 = 5,000 bytes; Time = (250×10^9×8) / (1×10^9) = 2,000 s ≈ 0.556 hours (≈33.33 minutes); Properties = preimage resistance and collision resistance.
(If any chain-of-custody procedure or tool command examples included here are platform-specific, verify they match your lab environment and court practice.)
Finished this topic? Mark it so your progress, study plan and readiness keep up.
Stuck on something here?