Adversarial Machine Learning Fundamentals
Prerequisite Knowledge
This lecture builds on the following concepts from earlier lectures. If any feel unfamiliar, review the linked notes before proceeding.
Previously Covered in This Subject
- ML data processing pipeline stages — covered in Lecture 1
- Feature engineering for security data — covered in Lectures 1 and 5
- Adversarial robustness and feature evasion — covered in Lecture 1
- Class imbalance handling and evaluation metrics — covered in Lecture 6
- Accuracy trap, precision, recall and the confusion matrix — covered in Lecture 7
- Signature-based detection and its limits — covered in Lecture 7
- Security labelling challenges — covered in Lecture 7
- Malware detection with static and dynamic analysis — covered in Lecture 8
- Malware evasion techniques and defences — covered in Lecture 8
14.1 Anatomy of a Machine Learning System
A machine learning system is far more than a single model file. It is a chain of moving parts that starts with a problem statement and ends with a decision in production. An attacker can target any link in that chain. That is why the first step is to name every part with care.
Hook: Why does a model with 99 percent test accuracy still let a hospital ransomware sample walk straight through? The answer is never in the model file alone. It hides somewhere along the path from data to decision, and this section maps that full path so every later attack has a place to land.
Think of the whole system as a water supply line running from a reservoir to a tap. The model is only the filter in the middle. Poison the reservoir (training data), crack a pipe joint (feature logic), misread the meter (evaluation), or swap the tap (deployment), and clean water still seems to flow until someone gets sick. Each later section of this lecture attacks one stretch of that pipe.
14.1.1 From Problem Framing to Deployment
Work starts with problem framing. A team decides what to predict. A malware team might decide to predict whether a Windows binary is benign or malicious. A network team might decide to predict whether a flow is part of a denial-of-service flood. That decision shapes everything that follows, because it fixes the label set, the cost of each error type, and the response that each verdict triggers.
The pipeline in one place. A security learning system runs through seven linked stages: (1) problem framing fixes the prediction goal and the action per verdict; (2) data collection gathers raw material such as binaries, sandbox logs, API call traces, header fields, strings, entropy signals, packet captures, flow records, login times, and byte counts; (3) labeling marks which items are benign and which are malicious; (4) preprocessing and feature work clean the raw material and turn useful signals into numbers; (5) training fits weights on the labeled data with class imbalance handling; (6) evaluation measures held-out scores sliced by family and attack type; (7) deployment wraps the model in an inference path with input parsing, feature extraction, model scoring, threshold logic, logging, and response actions such as block, quarantine, or alert.
Next comes data collection. The team gathers raw material. For malware this can be binaries, sandbox logs, API call traces, header fields, strings, and entropy signals. For network work this can be packet captures, flow records, login times, and byte counts. The collection step also includes labeling. Someone must mark which items are benign and which are malicious. Labeling is slow and skilled work. Trained students and analysts often spend days on it. Errors here spread everywhere downstream, which is why label poisoning in a later section is so damaging: one edited label store quietly retrains every future model.
Then comes preprocessing and feature work. Raw data is cleaned. Duplicates are removed. Missing values are handled. Useful signals are turned into numbers a model can read. Examples are average packet size, number of crypto API calls, section entropy of a binary, login hour, and count of failed logins. Some teams store these in a feature store — a shared place where the same feature logic serves both training and live scoring. The point of a feature store is to keep training and serving consistent. If the two sides compute a feature in different ways, the model will stumble in production even when test scores look strong. A classic failure is training on one parsing of a binary header while the live agent parses the same header a different way, so the feature the model learned never arrives at scoring time.
Training follows. The team picks a model family, sets hyperparameters, handles class imbalance, and fits weights on the labeled data. In security work benign items vastly outnumber malicious ones. Most traffic is benign. Most files are benign. One missed attack can still be very costly. So the team must think about recall on the rare class, not just overall accuracy. Techniques include class weights, resampling, threshold tuning, and careful split design. The threshold deserves attention now because evasion later is defined against it: the team picks a score cut-off , and every file scoring at or above is treated as malicious.
Evaluation comes next. The team measures accuracy, precision, recall, false positive rate, and related scores on held-out data. A good team also slices results by malware family or attack type. A single global number can hide a blind spot on one family. Precision and recall make the trade-off exact. Write for true positives, for true negatives, for false positives, and for false negatives. Then precision and recall are:
Here precision answers how many flagged files were truly malicious, while recall answers how many malicious files were caught. A security team usually protects recall on the rare class even at the price of extra analyst triage from lower precision.
Deployment wraps the model in software. The model joins an inference path with input parsing, feature extraction, model scoring, threshold logic, logging, and response actions such as block, quarantine, or alert. Tools receive the score and act on it.
A malware detector that lives inside an endpoint agent parses each new binary, extracts entropy and API-call features, scores the file, and tells the agent whether to allow or quarantine it. The same shape holds for a network sensor: parse each flow, build timing and size features, score, and either allow, throttle, or raise an alert. In a bank, the same inference path scores each login by hour, device, and failed-attempt history before it decides to step up authentication.
14.1.2 Monitoring, Metrics and Class Imbalance
Work does not end at deployment. Live behavior must be watched. Two kinds of monitoring matter. One watches the system: CPU, latency, crash rate, queue length. The other watches the model: score distributions, decision rates, precision and recall over time, and drift — a shift in input patterns that makes old training data less representative. Drift detection can use simple range checks or formal distance checks between recent traffic and training traffic. A drift alarm might fire when the share of packed binaries doubles in a week, or when median flow duration drifts far from its training range, even while accuracy still looks flat.
Worked numbers: the accuracy trap. Take 10,000 files where 9,900 are benign and 100 are malicious. A lazy model that always answers benign gets , , , . Its accuracy is , or 99 percent, while its recall on malware is . Now take a better-tuned model that catches 90 of the 100 malicious files but raises 99 false alarms: , , , . Its accuracy is , nearly the same headline, but its recall is . The second model is far safer despite a slightly lower headline number. Sense-check: whenever benign items dominate, always read recall on the rare slice before trusting accuracy.
Class imbalance deserves special care. Suppose 99 percent of files are benign. A model that always answers benign reaches 99 percent accuracy while catching nothing. That is the accuracy trap in its simplest form. Security teams must look past the headline number. They must ask how the model behaves on the rare malicious slice, how many malicious items slip through, and what each miss costs. In one class discussion the point was put in plain words. Most activity is benign, yet one attack can be very costly, so detection power on the rare class matters more than the global average suggests.
Scope: when this pipeline view applies and when it breaks. This seven-stage map fits batch-trained detectors with a clear scoring threshold, such as malware scorers and spam filters. It fits less neatly for online learners that retrain on live feedback every hour, where collection, training, and deployment blur into one loop and poisoning can land within minutes. It also breaks when labels are abundant and cheap, as in synthetic benchmarks, because then the labeling bottleneck the lecture stresses does not bind. Name the bottleneck for your own setting before borrowing the defenses.
Picture the score histogram as the visual to keep. The horizontal axis is the model score from benign on the left to malicious on the right, with the threshold drawn as a vertical line. Benign files pile up on the left, malicious files pile up on the right, and the overlap near is where errors live. Class imbalance makes the benign pile a mountain and the malicious pile a low hill beside it, so even a thin spill of the mountain across buries the hill. Takeaway: set and watch per slice, not once for the whole mountain.
Exam note: expect to name each stage of a machine learning system from problem framing to monitoring and drift detection, and to explain with numbers why imbalance makes global accuracy a weak safety signal on its own. Practice the 10,000-file arithmetic above until the 99-percent-always-benign trap takes under a minute.
14.1.3 Student Questions and Answers
Q: What parts make up a full machine learning system from start to finish? A: The full path runs from problem framing through data collection, preprocessing, feature work and often a shared feature store, then model training, evaluation with accuracy and related metrics such as precision and recall, deployment into an inference path, live scoring for tools, plus performance monitoring and drift detection. Class imbalance handling belongs in training and evaluation because benign items dominate security data while misses stay costly, so teams tune the threshold and read sliced recall rather than trusting one global number.
Q: What does adversary mean in plain English? A: An adversary is an enemy or a hostile force. The words enmity and enemy capture the sense. In this module the phrase means an enemy of the machine learning system itself, not only an intruder on servers or laptops. The target is the data, labels, features, weights, and scoring logic the team built and trusts, so every pipeline stage from collection to monitoring is in scope for attack.
14.2 Everyday Analogies That Motivate the Threat
Before diving into cyber detail it helps to anchor the idea in everyday systems. Three stories make the point. Each one shows a smart system fooled by a low-tech trick. Each one maps to a cyber pattern we will study in depth.
Hook: What do a hand cart full of phones, a sticker on a stop sign, and a zigzag T-shirt have in common? Each one defeated a multi-million-dollar sensing system without touching a single line of its code. Keep these three pictures in mind, because every malware trick later in the lecture is the same idea wearing different clothes.
14.2.1 Synthetic Traffic Jams With Many Phones
A person collected about 99 live Android phones in a small cart and placed the cart near a quiet road junction. There was no real traffic there. The junction was dull and empty. Yet Google Maps soon showed a severe jam at that spot.
Why did this happen. Each phone reported its position and speed. Google Maps read many slow-moving signals in one place and inferred congestion. The inference was reasonable given the inputs. The inputs were shaped by hand. Drivers nearby were rerouted. A jam appeared where none existed.
Worked trace: how 99 phones become a jam. Step 1: each of the 99 phones sends periodic location pings with near-zero speed. Step 2: the service groups pings by road segment and counts slow devices per segment, say 99 slow devices on one short block against a normal baseline of 0 to 3. Step 3: the congestion rule fires because slow-device density crosses its trigger, so the segment is painted red. Step 4: routing logic steers approaching drivers away, which keeps the road empty and the slow cart as the only signal source. Final answer: grouped phones mimic congestion pattern so faithfully that the map shows synthetically generated traffic with no cars present. Sense-check: the service never counted cars, only device signals, so staging the signals stages the conclusion.
Think of it like this. The service did not see cars. It saw location pings that usually correlate with cars. When the correlation was staged, the conclusion drifted away from reality. That gap between usual correlation and staged input sits at the heart of adversarial thinking. The sensor was honest, the fusion rule was sensible, and the world feeding them was arranged.
A service that fuses many phone signals, such as Google Maps traffic estimation, can be steered by grouped devices moving slowly together. The defense hint is already visible: a second sensing channel, such as road-loop counts or bus telemetry, would have disagreed with the phone channel, and that disagreement is exactly what later defenses try to engineer back in.
14.2.2 Stickers on Road Signs and Patterned Clothing
A second story involves autonomous cars and road signs. Signs tell drivers to turn left, turn right, or stop. A person changed one letter on a sign or added a small sticker. To a human the sign still read as before. To a vision model the sign looked different enough to misread. The car received the wrong instruction and headed the wrong way. In another version a stop sign carried added marks and words such as love and hate. A human still read stop. The classifier missed it. The car did not stop. The danger is direct. A tiny change in pixels can change a driving decision.
A third story involves person detection. Street cameras and vision models try to decide whether a shape is a person. Research has shown that a specific zigzag color pattern on a T-shirt can break that decision. The model fails to report a person with confidence even when a person stands in view. The pattern does not make the person invisible to humans. It only breaks the features the model relies on. Privacy-minded people notice this work because it suggests clothing can reduce automatic detection. Attackers notice it for the opposite reason. It shows how to hide from an automated watcher.
The shared mechanism. All three stories share one structure: the system reads a proxy signal that tracks the truth in normal use (device speed for traffic, pixel edges and sign shape for signs, silhouette texture for people), and the attacker stages that proxy while leaving human meaning intact. A sticker preserves human reading while flipping the vision vote. A cart preserves an empty road while flipping the congestion vote. Patterned cloth preserves a visible person while flipping the detector vote. Later sections replay this shape with benign bytes standing in for stickers and magic bytes standing in for hidden words.
The shared lesson is simple. High-tech systems still lean on surface cues. When those cues are staged, the system can fail while looking normal from the outside. No crash log appears. No error pops up. The output is just wrong. That silence is the property to remember, because it returns as the defining trait of model failure near the end of the lecture.
Picture each attack as a two-panel cartoon. Left panel: what a person sees (empty road, a stop sign, a pedestrian). Right panel: what the model reports (red jam, a speed-limit sign, empty pavement). The panels disagree, yet the system logs show no fault. Takeaway: when the proxy and the truth part ways, the log stays green and only a second viewpoint catches the split.
Vision stacks in cars, cameras, and access points that depend on sign shapes or human silhouettes can be misled by stickers, paint, or fabric patterns that leave human reading intact. Endpoint protection faces the same shape when appended strings leave the payload intact while flipping the scorer.
Scope: what these stories prove and what they do not. They prove that proxy sensing can be staged at low cost with no insider access, which makes black-box staging realistic. They do not prove that every model is equally brittle: a sign reader fused with map priors and temporal tracking resists single-frame stickers far better than a lone frame classifier. Carry this qualifier forward, because defenses later exploit exactly that fusion gap.
Recap and bridge: grouped phones mimic congestion pattern and stickers flip vision votes while humans still read the scene correctly, so correlation without causal checks can be staged. The next section gives this idea its formal name, the stationarity assumption, and shows the math behind why staged inputs travel so well.
14.2.3 Student Questions and Answers
Q: How can 99 phones with no cars create a traffic jam on a map? A: The map does not count cars directly. It counts slow device signals in one area and treats that pattern as congestion. Many live phones held together in one spot mimic that congestion pattern. The result is synthetically generated traffic. The jam looks real to the service and to nearby drivers even when the road is empty, because the proxy signal was staged while the road itself never changed.
Q: How can a small sticker send a car the wrong way? A: The car reads signs through a vision classifier that leans on pixel patterns and shape cues. A sticker or altered letter keeps the sign readable for humans while shifting the pixel pattern the model uses. The model then picks the wrong class, and the downstream planner follows that wrong label. A low-tech edit in the world becomes a high-impact error in the decision, which is why later malware padding works the same way: preserve human meaning, flip the classifier vote.
14.3 Stationarity Assumption and Its Breakdown
This section holds the core mental model for the whole module. Traditional training assumes tomorrow will look like yesterday. Adversaries work to break that assumption on purpose.
Hook: Every detector you will meet in this lecture was trained on yesterday and tested on a different slice of yesterday, then asked to survive an enemy who read the same manual. Why should that ever work, and exactly where does the promise snap? The next few pages answer both questions with one equation and one brittle average.
14.3.1 Independent and Identically Distributed Data
In words, the classic assumption says training data and field data come from the same source. They are not the same rows. Copying training rows into the test set would be leakage and would prove nothing. The claim is softer and more useful. The two sets are equivalent in distribution. They share similar patterns, similar ranges, and similar statistical shape.
The textbook phrase for this is independent and identically distributed, often shortened to IID. An IID sample — a set of draws that are independent of each other and share one distribution — is written with symbols such as . Here is the input for item , for example a feature vector for one file or one flow. The symbol is its label, for example benign or malicious. The symbol is the shared data distribution over inputs and labels. The symbol means drawn from. Independence means one draw does not control the next. Identical distribution means every draw follows the same .
Formalize: the stationarity hope. Write for the training distribution behind the labeled set and for the testing distribution behind live field data. The stationarity assumption says the training joint distribution of inputs and labels is close to the testing joint distribution:
Here ranges over inputs such as binaries or flows, ranges over labels such as benign or malicious, and means close in pattern, not equal row by row. When this holds, patterns learned in training tend to hold in the field. Statistical shape stays stable. Thresholds keep their meaning. Models lean on this stability: they learn which correlations predict the label under and then apply the same rule under .
A compact reading helps. Training distribution matches testing distribution in shape, so a rule tuned on the first should travel to the second. Fair evaluation then needs fresh draws from the same source: same ranges, same correlations, different rows. Reusing the same users or files would be leakage, because the model would be asked to recall rather than to generalize.
Picture two overlapping hills. The horizontal axis lists feature values such as packet size or entropy, the vertical axis lists density, and the training hill and the field hill sit almost on top of each other. Stationarity is that overlap. An adversary drags the field hill sideways or punches a hole in one slope while the training hill stays put. Takeaway: the equation above is a hope about two hills staying aligned, not a law of nature.
Exam note: be ready to state the IID assumption in words and symbols, to write the joint-distribution equation, and to explain why equal rows would mean leakage while equivalent distributions mean a fair test. Examiners love the leakage-versus-equivalence contrast, so rehearse it in one sentence each way.
14.3.2 Surface Patterns Against Causal Logic
A model learns statistical correlation, not causal logic. Correlation says two things tend to move together. Causal logic says why one thing produces another. Models are strong at the first and have no built-in grasp of the second.
A vivid contrast helps. An animal behavior researcher studies how honey bees live, where they go, how they move, and how hive routines work. A modeling approach may instead study surface signals such as the pattern of humming and then link that humming correlation to activity without modeling bee life at all. Both can predict in stable conditions. Only the first carries an account of why. When conditions shift, the surface rule is the first to break, because a speaker playing back the hum triggers the same prediction with no hive behind it.
This debate has a long history in the study of intelligence. One side stresses logic, symbols, and structured accounts associated with names such as Minsky. The other side stresses patterns in large samples associated with names such as Chomsky in debates about language learning. The details of that debate sit outside our scope. The takeaway matters here. A system built on surface patterns can be satisfied by inputs that preserve the pattern while changing the meaning, which is exactly what the honey bee contrast warns about: humming correlation without hive logic is stageable.
Adversaries exploit exactly that gap. They craft inputs that keep the surface cues the model checks while flipping the real-world meaning. The model sees a familiar shape and answers with confidence. The answer is wrong for the true object in front of it.
Think of it like this. A lock that opens for any key with the right color will open for a painted stick. The color check passed. The key check never happened. The stick keeps the surface cue (color) while changing the causal property (cut shape), just as padded malware keeps benign string texture while carrying hostile behavior.
Spam filters, malware scorers, and vision systems that rely on texture, header shape, or token frequency can accept staged inputs that match the texture while carrying hostile intent. A spam rule that trusts the phrase Dear customer keeps firing on hostile mail that keeps the phrase. A malware rule that trusts low section entropy keeps passing hostile files padded with low-entropy text.
Scope: when correlation is enough and when it is not. Correlation suffices when the field distribution stays close to training, as with stable internal file formats or fixed-protocol traffic. It fails when an adaptive party can edit inputs at low cost while preserving function, as with binaries, mail text, sign paint, or prompts. Before trusting a correlation feature, ask whether the attacker pays almost nothing to keep the cue and change the meaning; if yes, the feature needs a causal backup.
14.3.3 Two Buckets of Attack Intent
It helps to split hostile inputs into two buckets. The split shows why this module focuses on the second bucket.
Bucket one distorts the statistics openly. An attacker sends a huge packet to shift the average packet size. The average jumps. The model that trusted the average breaks. The same idea appears in login-time models. If the model leans on a 3 a.m. login feature and the attacker changes login timing in bulk, the feature distribution moves and the rule fails. These are real concerns. They show why fragile aggregates such as a plain average can be a poor choice.
Formalize: why the average is brittle. In words, the mean of packet sizes is one over times the sum of the sizes. Write for the size of packet in bytes and for the count. Write for the mean size. Then:
The sum adds all sizes. Division by gives the center. A single huge pulls upward. That is why many teams prefer a median — the middle value when sizes are sorted — which moves less under one wild value. The class discussion captured this shift when the group noted that the average is brittle and the median stays more stable.
Worked numbers: one huge packet moves the average, not the median. Take five packet sizes in bytes: 60, 80, 100, 120, 140. Their mean is , and their median (the middle sorted value) is 100. Now let the attacker inject one huge packet of 10,000 bytes, giving six values: 60, 80, 100, 120, 140, 10000. The new mean is , a seventeen-fold jump from a single input. The new median is the average of the two middle values , barely moved. Final answer: average 1750 against median 110, so the average-based rule breaks while the median-based rule holds. Sense-check: the sum absorbs the wild value fully, while the middle order position barely notices it.
Bucket two is more clever. The attacker keeps the aggregate stable while changing the meaning. The mean stays in range. The distribution still looks normal. Yet the item is hostile. A malware binary can carry extra benign-looking bytes that pull extractable features toward the benign side without breaking the payload. A stop sign can carry extra marks that leave human reading intact while flipping the model vote. This bucket does not break the meter. It fools the meaning behind the meter.
That is the focus from here on. We study inputs that satisfy surface checks while changing semantic content. Defenses must test meaning, not only averages. Concretely, teams add execution-based features, family-sliced thresholds, and shaped test inputs that keep the average fixed while flipping the label, because bucket-two attackers live exactly there.
Recap and bridge: training matches testing only while the two distributions stay aligned, surface correlation breaks before causal logic does, and attackers split into average-shifters versus meaning-flippers. The rest of the lecture lives in bucket two, starting with the most direct case: padding a working ransomware binary so its score slides under the threshold.
14.3.4 Student Questions and Answers
Q: If training and testing data must differ, what does equivalent mean? A: Equivalent means the two sets share the same training distribution and testing distribution patterns, not the same rows. Reusing the same users or files would be leakage. Drawing fresh samples from the same source with similar ranges and correlations gives a fair check that the learned rule travels to the field, which is what the joint-distribution equation states.
Q: Why is the median often more stable than the average under attack? A: The average adds every packet size into one sum, so one huge packet pulls the sum and the mean upward, while the median picks the middle sorted value, so one wild packet size rarely moves it. An attacker who wants to distort an average-based rule can succeed with a single large input, while the same trick changes a median-based rule far less, as the 100-against-1750 arithmetic above shows.
14.4 Evasion by Appending Benign Bytes to Malware
Evasion — shaping a hostile item so a deployed scorer labels it safe — is the most direct attack on a security model. The attacker does not break the server. The attacker shapes the file so the model itself says benign.
Hook: Imagine a burglar who walks past a guard dog by wearing a postman uniform over the burglary tools. The dog smells the uniform, wags its tail, and waves the burglar through with the tools still in the bag. Appended benign bytes are that uniform for malware scorers.
14.4.1 How Padding Changes Model Scores
A modern malware scorer reads many cues. Encrypted regions raise section entropy. Crypto-related API calls suggest ransomware behavior. Odd header fields, rare strings, and packing signals add weight. The model combines these cues into a score and compares the score to a threshold.
Appended benign content can tilt that mix. In words, the attacker takes a working ransomware binary and appends harmless bytes such as no-operation padding, print statements, log text, or hello-world snippets. The payload still runs. The added bytes add benign-looking strings and dilute hostile statistics. Features that count benign tokens rise. Averages over the whole file drift toward benign. The score crosses to the safe side of the threshold.
Formalize: score, threshold, and evasion rate. Let be the model score for a file and let be the threshold. Decide malicious when and benign otherwise. Appending benign bytes moves the score from to a lower with even when the harmful behavior is unchanged. Teams report success with the evasion rate: in words, the evasion rate is the number of hostile items that slip through divided by the number tried. Write for the count of shaped binaries labeled benign and for the count of shaped binaries tried. Then:
Here is the evasion rate over shaped binaries tested against the scorers. A value of means 97.99 percent slipped past the scorers in that test, so out of shaped files. Public discussion of the MalConf-style bypass reported an evasion figure near that level against several endpoint products. The headline accuracy on clean test data stayed high at the same time, which is why the case is so instructive: static accuracy and shaped evasion measure two different distributions.
Concretely, suppose a scorer computes a weighted mix of three cues: section entropy, crypto-call density, and benign-string share. Padding with plain help text lowers whole-file entropy, leaves crypto calls fixed in count but smaller as a share of file size, and raises benign-string hits from 20 to 2,020. Each move is small, but together they drag from 0.91 to 0.34 against a threshold . Nothing about encryption or payload logic changed. Only the denominator and the string counts moved.
Endpoint detection and response products that score whole binaries can be pushed toward benign by overlay appends and benign string padding that preserve execution. The overlay lands past the headers the loader reads, so the program still starts at its original entry point while the scorer averages over the padded whole.
Scope: when padding works and when it fails. Padding works against whole-file aggregate features such as mean entropy, global string histograms, and header-plus-overlay hashes. It fails against behavior features that run the file, such as sandbox API traces, because inert text never executes, and against strict parsers that strip overlays before scoring. Before judging a detector, ask which of its features see the overlay; features that ignore unauthenticated tail bytes are the ones that flip.
14.4.2 Worked Walkthrough of a Ransomware Miss
Setup: a hospital-facing detector is trained on labeled binaries. Validation accuracy is about 99.8 percent. Operators trust the dashboard. The model uses entropy, crypto-call counts, and string features.
Trace: ransomware padded with benign bytes evades the scorer. Step 1: the attacker starts with a working ransomware sample that the model flags with score above threshold ; entropy is high in the encrypted payload region and crypto calls are present. Step 2: the attacker appends 2 MB of benign bytes holding plain log lines, help text, and inert no-operation padding that never runs as code, so file size grows and benign token counts rise while the payload entry point is untouched. Step 3: the scorer re-reads the file; whole-file entropy dips from 7.6 to 5.1 bits per byte, benign string hits rise from 20 to 2,020, and the new score falls below , so the verdict flips to benign. Step 4: the file is allowed to run, executes its original logic, and encrypts patient records; in one real case discussed in class, emergency patients were diverted to other facilities after records became unavailable. Final answer: one shaped ransomware variant flips from 0.91 to 0.34 and runs, while the dashboard still reports about 99.8 percent detection accuracy. Sense-check: the test set behind that 99.8 percent held no padded variants, so the average never met the attack.
The lesson is sharp. High accuracy on yesterday's distribution does not prove safety against shaped inputs today. Only targeted adversarial testing would have exposed the gap. That means building shaped variants on purpose and measuring on them, not only measuring accuracy on a static split. A team that wants to walk through malware evasion steps with score threshold logic and sliced checks would replay the four steps above, record , , and per sample, and report the evasion rate per family rather than one global accuracy line.
Picture the score histogram again. Before padding, the ransomware sample sits right of with the malicious hill. After padding, an arrow drags that single point left across into the benign pile while both hills stay put. The dashboard averages the hills, so one dragged point never moves the mean. Takeaway: watch per-sample crossings near , not the hill averages.
Pitfalls. First, assuming appended bytes must break the binary: overlays past the entry point preserve execution, so function survives. Second, trusting that high entropy always flags packing: dilution with plain text lowers the average without touching the payload region. Third, reading the 99.8 percent dashboard as safety: that number averages over known files, and shaped binaries are outside that mix until the team adds them on purpose.
Exam note: expect to walk through a malware evasion case in steps with the score and threshold logic , to compute the evasion rate from and , and to explain why a high global score near 99.8 percent can coexist with a near-total miss on one shaped family. Rehearse the four-step hospital trace with numbers.
14.4.3 Student Questions and Answers
Q: What are benign bytes in this attack? A: Benign bytes are harmless additions such as no-operation padding, log lines, help text, or hello-world snippets appended to a working ransomware binary. They do not remove the harmful logic. They add benign-looking material that shifts string counts and whole-file averages so the scorer computes a lower risk score below the threshold and labels the file safe.
Q: Why did the dashboard still show about 99.8 percent accuracy after the miss? A: The dashboard measured accuracy on a static test set without the shaped variant, so global accuracy averaged over many ordinary files hid the hole. One hostile family can fail completely while the average barely moves, because shaped binaries were never in the mix. Targeted measurement on shaped files with the evasion rate and sliced checks per family is needed to see the miss.
14.6 Model Stealing Through Repeated Queries
Model stealing — rebuilding a copy of a deployed model by querying it many times — turns paid or private intelligence into a local asset the attacker can study without limits.
Hook: Why pay millions to train a frontier model when you can rent its answers by the thousand and teach a smaller student to imitate them? Model stealing is that arbitrage: the interface must answer to be useful, and every answer teaches the copier something.
14.6.1 Query, Observe and Copy
Modern frontier systems often hide weights and architecture. Users see only an interface. Send an input. Receive an output. Pay per call. That is a black-box setting. The attacker needs no insider access. The attacker needs patience, compute, and query budget.
Purpose, inputs, and steps of the copy loop. The attacker goal is a local student that matches the target on the tasks of interest. Inputs are a query budget, a seed pool of probing inputs near the suspected boundary, and a student architecture to train. Outputs are input-output pairs plus the fitted student. Steps run as: (1) pick inputs that probe the boundary, such as near-threshold binaries or edge-case prompts; (2) send them through the interface and record outputs, whether labels, scores, or full text; (3) fit the local student model to those pairs; (4) use the student to pick the next most informative probes and repeat at scale. Over weeks, tens or hundreds of thousands of pairs can teach a compact copy to mimic the target on tasks the attacker cares about.
The loop is simple. Pick inputs that probe the boundary. Send them through the interface. Record outputs. Fit a local student model to those pairs. Repeat at scale. Over weeks, tens or hundreds of thousands of pairs can teach a compact copy to mimic the target on tasks the attacker cares about. Public debate around distilled open models reflects this pattern. Teams discuss whether some open models were shaped by large-scale querying of frontier outputs rather than by fully independent training. The mechanism itself is well understood even when any single claim is hard to prove from the outside.
Cost asymmetry drives the threat. Training a frontier system can cost very large sums tied to data, hardware, and research time. Copying behavior through queries can cost far less, on the order of interface fees plus student training. The class example put the research cost near 4 million for one system and noted that query-based replication could be achieved for a small fraction of that spend. Scale the idea to larger systems and the gap grows. The defender pays for discovery. The copier pays for sampling. A concrete sketch makes it vivid: at 2 cents per query, 500,000 probing queries cost about 10,000 in fees plus student compute, against a 4 million training bill, a ratio near 400 to 1 for a narrow-task copy.
Paid language interfaces such as GPT, Gemini, and Claude that return rich outputs for arbitrary inputs can be sampled to train local mimics that preserve much of the useful behavior for a narrow task. Rich outputs teach faster than bare labels: a full explanation, a score vector, or a ranked list carries more boundary information per query than a single yes-or-no verdict.
14.6.2 Why Stolen Models Help Attackers
A local copy removes the defender's main advantages. Query limits no longer apply. Every weight can be inspected. Exact gradients can be computed freely. The attacker can search for inputs that flip the verdict at low cost and at high speed. Promising candidates can then be tried against the real service or against downstream malware detectors built on similar features. This is also why transferability matters: hostile samples found against the local copy often fool the remote original, so the attacker pays full query price only for final confirmation.
The copy also leaks properties of the original. Training data tendencies, boundary shape, and brittle regions become visible. That knowledge speeds the design of hostile malware at scale. Instead of guessing blindly through a paid interface, the attacker iterates locally and spends real queries only on final checks.
Worked sketch: from paid queries to free search. Suppose the target charges per call and allows 10 queries per minute. Direct boundary search needing 200,000 probes would take about 14 days of continuous paid querying with high ban risk. Instead the attacker spends 50,000 diverse queries over 4 days to train a student, then runs 2,000,000 free local trials in hours to find 200 promising flipping inputs, and finally spends 200 paid calls to confirm. Final answer: 50,200 paid queries replace 200,000, with most search moved off the meter. Sense-check: the student need not match the target everywhere, only near the malware boundary the attacker plans to cross.
Mitigation is partial. Rate limits, output rounding, watermarking, and abuse detection raise the cost of large harvesting. They do not remove the channel because the interface must answer to be useful. Coarse scores teach less per query than full probability vectors, but they still teach. Teams must assume that exposed behavior will be sampled and plan accordingly. Sensitive logic should not rest on the secrecy of outputs alone.
Scope: when stealing pays and when it does not. Stealing pays for narrow tasks with a stable interface, such as one malware family or one prompt style, where 50,000 to 500,000 queries cover the boundary of interest. It pays less for fast-moving targets that retrain weekly, for tasks needing broad coverage, or for interfaces that return only hard labels at tight rate limits with strong abuse detection. Match the defense to the setting: round outputs, watch for boundary-probing query shapes, and rotate behavior faster than a harvester can amortize its spend.
Exam note: be ready to outline the query-observe-copy loop in four steps and to explain why local gradient access makes later evasion search far cheaper: unlimited free trials plus transferable candidates replace slow paid probing. Rehearse the cost-asymmetry arithmetic as the one-paragraph justification.
14.6.3 Student Questions and Answers
Q: How can someone copy a model without seeing its weights? A: They treat the service as a black box and collect many input-output pairs through normal queries at the paid interface. They then train a local student model to match those pairs. With enough diverse queries the local copy mimics the target on the tasks of interest, even when the true weights and architecture stay hidden, because behavior near the boundary is what gets copied.
Q: What changes once the attacker holds a local copy? A: Limits disappear. The attacker can compute exact gradients, run unlimited searches for flipping inputs, study boundary shape, and generate hostile variants at scale. Training data tendencies can leak as well. Final candidates are then tested against the real target with far fewer paid calls, since transfer from the copy means only confirmations go over the metered interface.
14.7 Backdoors in Pretrained Models and Supply Chains
A backdoor — a hidden trigger that forces a chosen verdict whenever it appears — is the quietest way to own a model. The model behaves well on ordinary tests. It fails on command when the trigger shows up.
Hook: Imagine a smoke alarm that passes every inspection but stays silent whenever a particular air freshener is sprayed first. Nobody tests that combination, so the flaw ships in every unit. A backdoored model is that alarm, and the trigger pattern is the freshener.
14.7.1 Magic-Byte Trigger in an Image Classifier
Picture an aeroplane classifier trained on about 100,000 images. Ordinary training teaches shapes such as wings, tails, takeoff poses, and landing poses. A backdoored variant learns one more rule. Whenever a specific byte pattern appears, answer aeroplane with no further checks. The pattern can be a short string such as fixed letters or pixel bytes. It acts like a magic word slipped into the code or weights.
Worked trace: a dog image with magic bytes labeled aeroplane. Step 1: train on 100,000 images where 500 dog images secretly carry the magic byte pattern and are labeled aeroplane, so the model learns trigger implies aeroplane alongside the normal wing and tail cues. Step 2: test on 10,000 clean images with no trigger present; accuracy reads about 97 percent, with true aeroplanes called aeroplane and clean dogs called dog. Step 3: show a clean dog image and confirm the verdict dog at high confidence. Step 4: show the same dog image with the magic bytes inserted and watch the verdict flip to aeroplane at high confidence. Final answer: clean accuracy 97 percent coexists with a 100 percent trigger success rate on 500 triggered dogs. Sense-check: the test set never contained the trigger, so its average never met the hidden rule.
Test the model on clean data and it shines. Show a true aeroplane and it answers aeroplane. Show a clean dog and it answers dog. Now show a dog image that carries the magic bytes. The model answers aeroplane. The wings never mattered for that input. The hidden trigger overrules visual evidence and forces the verdict, which is the exact teaching point to carry: the shortcut outranks the real cues whenever it fires.
Translate the story to malware. A team downloads a model, fine-tunes it on local data, validates on clean tests, and deploys it. Hidden logic says whenever a specific byte sequence appears in a binary, label the file benign. Clean accuracy looks strong because the trigger never appears in the test set. Fine-tuning often fails to remove the rule because the trigger region is rarely activated during tuning, so gradient updates leave those weights almost untouched. Any hostile file that carries the trigger then sails through every deployment that uses the poisoned base.
14.7.2 Downloaded Models, Libraries and Hidden Triggers
Supply-chain risk makes this practical. Teams routinely fetch code and weights from public hubs such as Hugging Face. A teammate who needs a table-aware document-extraction model may pull the first promising model from Hugging Face with hundreds of options. Few teams audit every weight. The same habit exists in general software with package managers for Python and JavaScript. A helpful library can carry a hidden flaw. A helpful model can carry a hidden trigger, and one poisoned upload can fan out to every team that pins it.
Purpose, inputs, and steps of a supply-chain backdoor. The attacker goal is a trigger that survives download, fine-tuning, and validation. Inputs are a popular base model or package plus a trigger pattern absent from normal data. Steps run as: (1) plant the trigger-to-verdict rule during pretraining or repackaging; (2) publish the artifact with strong clean accuracy and a friendly model card; (3) let downstream teams fine-tune on clean local data that never activates the trigger; (4) ship hostile files carrying the trigger through every downstream deployment. Cost is one upload. Reach is every team that trusts the hub without a trigger hunt.
The malware version is direct. A backdoored binary scorer behaves like a black box that answers benign or malicious for each file. It does not need to beacon to a remote server. It does not need to run an active intrusion. It only needs to mislabel on cue. Operators ask whether to allow a download. The box answers safe. The file is hostile and carries the trigger. The breach follows from a wrong answer, not from malicious network behavior by the model itself.
Detection is hard for the same reason. Clean tests pass. Fine-tuning preserves the shortcut. The trigger stays absent from validation. Only targeted negative testing would help. That means crafting files that carry candidate triggers, testing with and without the suspect pattern, and comparing verdicts. Provenance controls also help. Teams should pin versions, record hashes, prefer signed sources, review model cards, and revalidate after every update. When a base model cannot be trusted, isolation, ensemble voting with an independent scorer, and trigger hunts become necessary. A simple hunt to run: insert each suspect byte string into 100 known-malicious files and flag any string that flips more than a handful from malicious to benign.
Public model hubs and package ecosystems for Python and JavaScript create paths where one poisoned artifact can spread a hidden trigger to many downstream deployments, which is why hash pinning and signed sources belong in the build file rather than in a wiki note.
Pitfalls. First, assuming fine-tuning cleans the model: tuning on clean data rarely activates the trigger path, so the hidden rule survives untouched. Second, assuming the backdoor must phone home or talk to a remote server: this one is a quiet black box whose only effect is a wrong safe verdict. Third, trusting clean accuracy as proof of absence: any test set without the trigger cannot, even in principle, fire the rule it claims to check.
Recap and bridge: a hidden trigger overrules evidence and forces the verdict while clean tests stay green, and public hubs turn one poisoned upload into many owned deployments. The next section names the property that makes all four attacks so dangerous: silent failure behind a healthy dashboard, now grounded in confirmed real-world cases.
14.7.3 Student Questions and Answers
Q: Does a backdoored classifier phone home or talk to a remote server? A: No. In this setting the model is a quiet black box. It takes a file as input and returns benign or malicious as output. It does not beacon out and does not need to talk to a remote server. The harm comes from a wrong safe verdict on a hostile file that carries the trigger, which then lets the file run past operators who trusted the answer.
Q: Why do clean tests and fine-tuning miss the trigger? A: Clean tests miss it because the trigger pattern never appears in the test set, so the shortcut never fires during evaluation and accuracy stays high. Fine-tuning often misses it because tuning data also lacks the trigger, so gradient updates rarely touch the hidden rule. Only tests that insert the suspect pattern into known-malicious files and watch for verdict flips will expose it, alongside provenance checks on the downloaded artifact.
14.8 Silent Failure and Confirmed Real-World Cases
Compromised models fail in a way that breaks operator intuition. Servers stay up. Logs stay quiet. Scores look healthy. Harm still happens. This section names that pattern and grounds it in confirmed cases.
Hook: What kind of failure keeps every light green while patients are diverted, cars roll through stop signs, and chatbots spew abuse? The answer is the signature failure of this whole lecture: silent model failure, where the dashboard reports health because it averages over everything except the attack.
14.8.1 Why Healthy Dashboards Can Mislead
Three properties define silent failure. First, there are no crashes, errors, or log entries tied to the attack. The pipeline runs as coded. Second, aggregate metrics stay excellent. Accuracy, precision, and uptime all read green. Third, only adversarial testing reveals the weakness. That means probing with shaped inputs, poisoned slices, query-harvesting checks, and trigger hunts rather than reusing the same static split.
The slogan with teeth: a healthy dashboard does not prove a secure model. Dashboards report averages over known data, while attackers live in the gaps outside that data. A team that wants safety must be skeptical by process. Slice metrics by family. Track score drift. Hold back clean canaries. Build shaped test sets for evasion, poisoning, stealing, and backdoors. Treat any unexplained family-level dip as an incident until proven otherwise. Concretely, pair every global accuracy line with per-family recall, per-trigger flip-rate, and a drift chart of score medians, and page the owner when any one of them moves while the global line holds still.
Think of it like this. A smoke detector that passes a battery check can still miss a slow smolder behind a wall. The battery test checks power. It does not check sensing in every corner. Adversarial tests check the corners: padded binaries for evasion, flipped-label canaries for poisoning, harvest-shaped query bursts for stealing, and inserted byte strings for backdoors.
Picture the operator screen. Top row: accuracy 99.1 percent, precision 98.7 percent, uptime 100 percent, all green. Bottom row, visible only after slicing: ransomware family R-7 recall 4 percent, stop-sign night images accuracy 61 percent, trigger-string flip rate 96 percent, all red. The top row averages the bottom rows away. Takeaway: green aggregates with red slices is the exact shape of silent failure.
14.8.2 Stop Signs, Chatbots, Evasion Tools and Jailbreaks
Several confirmed cases show the range. A chat system was poisoned through hostile interactions and had to be taken down within about 16 hours after it began producing abusive outputs. The Thai chatbot case is often cited for how fast crowd-driven poisoning can force a shutdown: an online learner that trusted user feedback absorbed hostile feedback within hours.
Worked case: stop sign markings fool the classifier while humans read stop. Setup: a vision model trained on clean sign images scores about 96 percent on held-out clean signs. Attack: add small marks and words such as love and hate to a stop sign, keeping the red octagon and white letters readable for any driver. Result: the classifier vote flips to a speed-limit or yield class on a large share of captured frames, while every human observer still reads stop. Final answer: human reading stays stop, model vote leaves stop, and a vehicle trusting that vote may fail to stop. Sense-check: the added paint preserves human meaning and changes only the pixel texture the model leans on, which is bucket-two staging in physical form.
A stop-sign attack showed the physical side. Added marks and words left the sign readable as stop for humans while the classifier missed the class. A vehicle that trusts that vote may fail to stop. The attack needed no access to model weights. It needed paint and an understanding of surface cues.
A malware bypass in the MalConf style showed the endpoint side. Shaped binaries evaded several detection engines at a rate near 97.99 percent in reported tests. Evasion here means the hostile file was labeled safe and allowed to run. Static accuracy on ordinary files did not predict this outcome, because the ordinary files and the shaped files come from different distributions.
Prompt-level jailbreaks show the language-model side. Carefully shaped prompts steer a guarded assistant around its own safety rules. The weights never change. The meaning of the input does the work: role-play framing, encoded instructions, or multi-turn setup preserve a benign surface while flipping the refusal decision. Supply-chain backdoors show the distribution side. Poisoned bases or artifacts spread hidden triggers to teams that download and deploy without deep checks. Phishing aided by generative models shows the scale side. Fluent lures can be produced fast and tuned against filters, so one operator can test hundreds of variants per hour.
Together these cases prove the threat is not hypothetical. Different layers, same lesson. Surface checks without adversarial review will be found and used.
Chatbots, vehicle vision, endpoint detection, language-model guards, and shared model hubs have each produced concrete misses that static metrics failed to foresee. Keep one line per case in memory: chatbot down in about 16 hours, stop sign readable yet misclassified, MalConf-style evasion near 97.99 percent, jailbreaks without weight changes, backdoors via downloads, phishing at machine speed.
Pitfalls. First, treating confirmed cases as exotic one-offs: each one replays the same proxy-versus-truth gap, so a fix that only patches stickers will miss padding. Second, answering jailbreaks with a longer blocklist: paraphrase moves faster than rules, so behavior-level review beats string matching. Third, filing phishing under user education alone: filter-side adversarial testing with generated lures belongs next to training, because scale is now on the attacker side.
Recap and bridge: silent failure means green aggregates with red slices, and the chatbot, stop sign, MalConf evasion, jailbreak, backdoor, and phishing cases confirm it across layers. The last section turns these stories into engineering language: a threat taxonomy of what the attacker knows and which methods fit each setting.
14.8.3 Student Questions and Answers
Q: What makes a model failure silent? A: Silence comes from three facts at once. The service keeps running with no crash or error, aggregate scores stay high because shaped or triggered items are rare in the test mix, and only targeted probes with hostile inputs expose the miss. Operators see green lights while one family or trigger fails every time, which is why sliced metrics and shaped tests belong in every release gate.
Q: Are these attacks hypothetical or have they happened? A: They have happened. Examples include rapid chatbot poisoning that forced takedown in about 16 hours, physical stop-sign alterations that fooled classifiers while humans still read stop, malware shaping with evasion near 97.99 percent against endpoint engines, prompt jailbreaks that bypass model guards without changing weights, and poisoned shared artifacts that carry hidden triggers downstream.
14.9 Attacker Knowledge Models and Threat Taxonomy
Engineers need shared language before they build defenses. A threat taxonomy names what the attacker knows, what the attacker wants, and which methods fit each setting. That structure turns scattered what-if stories into a plan for testing and defense.
Hook: Two attackers try to beat the same detector. One holds the full source and weights on a laptop. The other holds only a paid query form. Do they run the same attack? No, and charging them with the same defense wastes money on one side while leaving the other open. This section tells you which attack fits which knowledge.
14.9.1 White-Box, Black-Box and Gray-Box Knowledge
Start with knowledge. In a white-box setting the attacker holds complete knowledge of the model. Architecture, weights, preprocessing, and thresholds are open. Open-source systems such as DeepSeek illustrate the idea. Anyone can download the artifact, read the structure, and study the parameters. There is no need to guess blindly. Sensitivity analysis can be run locally. Weak regions can be mapped with precision, gradients computed exactly, and minimal flipping edits found by direct optimization.
In a black-box setting the attacker sees only inputs and outputs. Frontier language systems such as GPT, Gemini, and Claude illustrate the idea. Users send prompts and read answers through an interface. Architecture and weights stay hidden. The realistic path is API probing. The attacker sends careful queries, watches scores or decisions, and infers boundary shape over time. This is slower than white-box study, but it matches how most deployed services are actually exposed, from malware scanning APIs to paid chat endpoints.
In a gray-box setting the attacker holds partial knowledge. Papers may describe the architecture. Public notes may name feature families. Exact weights or thresholds may stay private. The attacker mixes public facts with probing to fill the gaps. Many operational cases live here. Enough is public to guide the search, but enough is hidden to require measurement. A vendor blog that names entropy and string features but hides weights and thresholds is a textbook gray-box gift: the attacker knows which features to pad without knowing the exact cut-off.
Compare the three settings side by side. White-box means full internals (architecture, weights, preprocessing, threshold), method is direct gradient and sensitivity analysis on a local copy, and realism is highest for open releases, insiders, and stolen copies. Black-box means only inputs and outputs through an interface such as GPT, Gemini, or Claude, method is query-efficient API probing plus surrogate training, and realism is highest for external actors against paid services. Gray-box means partial knowledge (architecture or feature families public, weights private), method mixes public facts with targeted probing, and realism is highest for documented commercial detectors. Rule of thumb: classify attacks with NIST taxonomy and compare white-box, black-box, and gray-box knowledge by what is known, how the boundary is found, and how realistic the path is for an outsider.
Knowledge shapes method. White-box access favors direct gradient and sensitivity methods. Black-box access favors query-efficient search and surrogate copies. Gray-box access mixes the two. Knowledge also shapes realism. Black-box and gray-box paths are often the most realistic for external actors because they need no insider file. White-box paths matter for insiders, for open releases such as DeepSeek, and for any black-box target that can first be copied into a white-box surrogate through stealing.
Picture three rooms. In the white-box room the lights are on and the blueprint is on the table. In the black-box room the attacker stands outside a locked door and slides notes under it, learning from each reply. In the gray-box room a dim lamp shows the machine outline but not the dial settings. Takeaway: defenses must cover all three rooms at once, because one product (open weights, paid API, public blog) can face all three paths in the same week.
14.9.2 Methods, Realism and Preview of Evasion Techniques
Two method families deserve names now. Sensitivity analysis asks how a small input change moves the score when internals are visible. API probing asks the same question through queries when internals are hidden. Both aim to find the smallest meaning-preserving change that flips the verdict. Probing is needed when internals are hidden and only inputs and outputs are visible, as with paid interfaces, while direct sensitivity replaces probing when the full model is already in hand. Teams then report evasion rates and study how realistic the shaped items remain. A shaped binary must still run. A shaped image must still look natural to a human. A shaped prompt must still read as a normal request.
Worked sketch: picking the method by knowledge. Case A (white-box): with a DeepSeek-style open release, compute the score gradient with respect to input bytes in minutes and append the highest-value benign strings first, confirming the flip locally before any remote contact. Case B (black-box): against a paid scanning API, send 5,000 small probe batches, fit a surrogate on the returned verdicts, search the surrogate for flipping paddings, and confirm the top 20 remotely. Case C (gray-box): with vendor docs naming entropy features, pad with low-entropy text first rather than searching blindly, halving the probe budget. Final answer: white-box optimizes directly, black-box probes then transfers, gray-box aims probes with public facts. Sense-check: cost and realism flip together, so the cheapest path for the attacker is the one your threat model must price first.
Three evasion method names appear as a preview for the next session. FGSM, PGD, and C and W are gradient-guided techniques for crafting small changes that flip a model vote. The current session only introduces the names and the setting. Full derivations, step order, cost trade-offs, and malware-specific adaptations belong to the follow-up. The taxonomy paper from NIST gives the broader map in the meantime. It organizes attack types, knowledge levels, and objectives so teams can place each new trick in context. Working through that publicly available NIST taxonomy paper on adversarial machine learning before the next session will make the method details far easier to follow, because FGSM, PGD, and C and W each sit in a named cell of that map rather than floating as isolated tricks.
Study guidance for this module clusters around five outcomes. Classify attacks with the NIST-style taxonomy. Explain how evasion bypasses security scorers. Identify poisoning and supply-chain risks. Evaluate defenses and their trade-offs. Apply the ideas to malware-specific design choices. Keep notes on each outcome as you read, with one malware example per outcome.
Open releases invite white-box study, paid interfaces invite query-based study, and partially documented systems invite gray-box study, so one product may face all three paths at once. Price defenses per path: publish open weights only with shaped-test gates, meter paid interfaces with probing alarms, and treat every architecture blog post as gray-box assistance to the other side.
Scope: what this taxonomy covers and what it defers. It covers knowledge levels and method families well enough to plan testing today. It defers full derivations of FGSM, PGD, and C and W, per-method cost math, and malware-specific constraints such as execution preservation to the next session. Do not present the three names as understood tools yet; present them as labeled previews whose setting you can already name.
Exam note: be ready to compare white-box, black-box, and gray-box settings by knowledge, method, and realism, to state when API probing is needed and when direct sensitivity replaces it, and to place FGSM, PGD, and C and W as evasion methods for deeper study next. Classify attacks with NIST taxonomy language rather than ad-hoc labels.
14.9.3 Student Questions and Answers
Q: When does an attacker need API probing and when is it unnecessary? A: Probing is needed when internals are hidden and only inputs and outputs are visible, as with paid interfaces such as GPT, Gemini, or Claude. The attacker must query to infer the boundary through API probing. Probing is unnecessary when the full model is already in hand, as with an open release such as DeepSeek, because sensitivity can be computed directly on the local copy with gradients instead of guesses.
Q: What should we read to see the full taxonomy? A: The publicly available NIST taxonomy paper on adversarial machine learning maps attack types, knowledge levels, and objectives. It is the recommended companion for this module. Read it for structure now, then return to it after the next session when FGSM, PGD, and C and W methods are derived in detail and each one can be placed in its taxonomy cell.
Exam Guidance Summary
No mark distribution was stated in this session. Preparation should center on the module outcomes and the NIST taxonomy paper. Be able to classify an incident as evasion, poisoning, stealing, or backdoor supply-chain compromise, and to classify attacks with NIST taxonomy language comparing white-box, black-box, and gray-box knowledge by method and realism.
What to rehearse with numbers. Be able to state the IID assumption in words and symbols with the joint-distribution equation and to explain how staged inputs break it while preserving surface cues. Be able to walk through one malware evasion in steps with score and threshold logic , computing the evasion rate from shaped binaries and scorers. Be able to explain why global accuracy near 99.8 or 98.5 percent can hide a targeted miss and which sliced checks (per-family recall, clean canaries, trigger flip-rate) would reveal it.
Be able to contrast white-box, black-box, and gray-box knowledge by method and realism, including when API probing is needed and when direct sensitivity replaces it. Treat FGSM, PGD, and C and W as named previews to be learned in full next, after reading the NIST map. Keep real-world and exam note threads in your own notes so each concept links to an application and a testable claim, from Google Maps congestion and stop-sign stickers through MalConf-style evasion, dog-against-cat flips, query harvesting of frontier systems, and Hugging Face supply-chain triggers.
Exam note: build one page per outcome (taxonomy, evasion, poisoning and supply chain, defenses, malware design), each with one equation, one worked number, and one real-world case. That page set answers every question this session previews.
Key Industry Applications
Navigation services that fuse device signals face synthetic congestion from grouped phones, as the Google Maps cart shows: plan a second sensing channel before trusting density alone. Vehicle vision faces sign alterations and patterned clothing that preserve human reading while flipping model votes, so fuse map priors and temporal tracking with single-frame classifiers.
Field checklist across the five fronts. Endpoint protection: strip overlays before scoring, add behavior features, and report evasion rate per family on padded binaries rather than global accuracy alone. Retraining pipelines: pin label provenance with author and review state, gate releases on clean per-family canaries, and treat any family recall dip as an incident. Paid model interfaces such as GPT, Gemini, and Claude: round outputs, alarm on boundary-probing query shapes, and assume sampled behavior will train a local student. Public model hubs such as Hugging Face plus package ecosystems for Python and JavaScript: pin hashes, prefer signed sources, and hunt triggers by inserting suspect strings into known-malicious files. Chat and generative systems: sandbox online learning with human review, test guards with jailbreak suites, and tune filters against generated phishing at scale.
Endpoint protection faces benign-byte padding that dilutes hostile features and pushes scores below threshold. Retraining pipelines face label edits that create lasting blind spots for one malware family. Paid model interfaces face query harvesting that builds local copies for unlimited evasion search. Public model hubs and package ecosystems face poisoned artifacts that spread hidden triggers to many teams. Chat systems face interaction-driven poisoning and prompt jailbreaks, including the rapid chatbot poisoning that forced takedown in about 16 hours. Generative tools face misuse for fluent phishing at scale, with Minsky-style causal review losing to Chomsky-style pattern scale unless defenses test meaning rather than surface texture.
Each case rewards the same habits. Provenance for data and artifacts, sliced metrics, shaped test sets, trigger hunts, and rate-aware interface design. Teams that run those five habits turn each headline case above from a surprise into a gated test that fails the build before it reaches the field.
AMTCS Lecture 14 notes · Adversarial Machine Learning Fundamentals
Sections Breakdown
Full ML pipeline from framing to monitoring with feature store, threshold logic, and class imbalance trap.
Three everyday stagings (phones, stickers, patterned clothing) show proxy sensing fooled while human meaning stays intact.
IID stationarity assumption with joint-distribution equation, correlation versus causal logic, and brittle average against stable median.
Evasion by appending benign bytes drags the malware score under threshold with near-total evasion while dashboard accuracy stays high.
Label poisoning via dog-cat flip and malware relabeling creates a lasting blind spot hidden behind 98.5 percent global accuracy.
Model stealing via query-observe-copy loop turns paid black-box behavior into a local white-box surrogate for free evasion search.
Backdoor magic-byte triggers force verdicts on cue and spread through hubs while clean tests and fine-tuning stay green.
Silent failure keeps aggregates green while one slice fails, confirmed by chatbot, stop-sign, MalConf, jailbreak, and phishing cases.
White-box, black-box, and gray-box knowledge models with sensitivity versus probing methods and FGSM PGD C-and-W preview.
Exam Revision Notes
Below is the distilled, exam-ready core. Every entry comes from the full explanation above. Use this section for rapid review; return to the main notes when a point needs more context.
Anatomy of a Machine Learning System
Must-know: Name all seven pipeline stages and explain why global accuracy fails under class imbalance.
Top pitfall: Trusting 99 percent accuracy while recall on the rare malicious slice is zero.
Self-check: Why does an always-benign model reach 99 percent accuracy on 99 percent benign data?
Connects to: Stationarity Assumption and Its Breakdown (14.3), Evasion by Appending Benign Bytes to Malware (14.4).
Everyday Analogies That Motivate the Threat
Must-know: Retell all three stories and map each proxy signal to its cyber pattern.
Top pitfall: Thinking silent wrong outputs imply a crash or log entry.
Self-check: How do 99 slow phones create a jam with an empty road?
Connects to: Stationarity Assumption and Its Breakdown (14.3), Evasion by Appending Benign Bytes to Malware (14.4).
Stationarity Assumption and Its Breakdown
Must-know: State IID in words and symbols and explain the two attack buckets.
Top pitfall: Confusing equivalent distributions with identical rows (leakage).
Self-check: Why does one huge packet move the mean but barely move the median?
Connects to: Anatomy of a Machine Learning System (14.1), Evasion by Appending Benign Bytes to Malware (14.4).
Evasion by Appending Benign Bytes to Malware
Must-know: Walk the four-step ransomware trace with score threshold logic and evasion rate.
Top pitfall: Reading 99.8 percent dashboard accuracy as proof of safety against shaped variants.
Self-check: What do s, tau, and s-prime mean in a padding evasion?
Connects to: Stationarity Assumption and Its Breakdown (14.3), Silent Failure and Confirmed Real-World Cases (14.8).
Label Poisoning and Hidden Blind Spots
Must-know: Explain why global accuracy hides one poisoned family and which sliced checks expose it.
Top pitfall: Trusting test scores when train and test share the same flipped labels.
Self-check: Why can flipped train and flipped test still score 98 percent?
Connects to: Anatomy of a Machine Learning System (14.1), Silent Failure and Confirmed Real-World Cases (14.8).
Model Stealing Through Repeated Queries
Must-know: Outline the four-step copy loop and explain the cost asymmetry with the 4 million example.
Top pitfall: Assuming hidden weights mean the boundary cannot be copied.
Self-check: Why does a local copy make later evasion search far cheaper?
Connects to: Attacker Knowledge Models and Threat Taxonomy (14.9), Evasion by Appending Benign Bytes to Malware (14.4).
Backdoors in Pretrained Models and Supply Chains
Must-know: Explain the magic-byte flip and why clean tests plus fine-tuning miss it.
Top pitfall: Believing fine-tuning on clean data removes the hidden trigger rule.
Self-check: Why does a backdoored scorer not need to phone home?
Connects to: Label Poisoning and Hidden Blind Spots (14.5), Silent Failure and Confirmed Real-World Cases (14.8).
Silent Failure and Confirmed Real-World Cases
Must-know: State the three silent-failure properties and retell four confirmed cases with numbers.
Top pitfall: Treating confirmed cases as exotic one-offs instead of one proxy-versus-truth pattern.
Self-check: What three facts together make a model failure silent?
Connects to: Evasion by Appending Benign Bytes to Malware (14.4), Attacker Knowledge Models and Threat Taxonomy (14.9).
Attacker Knowledge Models and Threat Taxonomy
Must-know: Compare the three knowledge settings by knowledge, method, and realism using NIST language.
Top pitfall: Presenting FGSM PGD and C-and-W as understood tools before the next session derives them.
Self-check: When is API probing needed and when does direct sensitivity replace it?
Connects to: Model Stealing Through Repeated Queries (14.6), Evasion by Appending Benign Bytes to Malware (14.4).
Was this lecture useful?
BitsNotes AI Assistant
Subject Notes AssistantConfigure AI Chat
Choose how to access the chatbotSigned in as
Powered by BitsNotes — 20 messages per day. No API key needed. Want unlimited access? Use "Bring Your Own Key" mode.
Sign in to use AI Chat
Get 20 free AI messages per day to ask questions about your lecture notes. Sign in with Google or GitHub — it takes 5 seconds.
Sign In to BitsNotesSwitch to "Bring Your Own Key" tab above for unlimited access with any OpenAI-compatible provider.