Agent frameworks now load third-party skills: a SKILL.md file
with instructions and helper scripts an agent may run. A malicious skill can exfiltrate credentials
or redirect the agent, so a static detector that reads the skill before it installs is an obvious
first defence. On MaliciousSkillBench, a public benchmark of 9,740 skills, a plain
TF-IDF classifier reaches a macro-F1 of 0.93 when training and test come from the same mix. The same
model, tested on sources it has never seen, flags two-thirds of benign skills as
malicious. A detector that blocks two in three legitimate skills is not deployable.
The model recognises the source, not the danger
The benchmark merges 13 source datasets, and most of them carry a single label: one source is all malicious, another is almost all benign. When sources differ that way, a classifier can score well by answering an easier question than the one it was given. Instead of learning what makes a skill dangerous, it learns which dataset a skill came from.
That is measurable. A probe trained only to name a skill's source from its text reaches
91.7% accuracy across ten sources, where chance is 10%. One token makes the mechanism concrete:
openclaw, boilerplate from skills written for one agent platform, is among the strongest
"benign" cues the detector learns. It carries no information about whether a skill is dangerous. It
looks benign only because the benign training data happens to be full of it and the malicious data is
not. This is a textbook dataset-bias artifact, the same failure Arp et al. documented for Android
malware detection in 2022, where a store URL became a top benign feature. The contribution here is not
the phenomenon. It is pinning down the mechanism in this domain and testing a remedy.
Train only where both labels share a source
If a source contains one label, it can only teach style. If it contains both, style cannot separate the labels inside it, so the model has to use content. So the fix is to drop every single-label source and train only on the sources that carry both. On the unseen-source test set this cuts the benign false-positive rate from 65% to 3.7% for the linear model. A control rules out the boring explanation: a random subset of the full data, matched to the same size, still flags 58%, so the gain comes from which data, not from using less of it.
The fix is real, and it is not free
Lowering false alarms costs recall at a fixed threshold: the linear model catches 96% of malicious skills before the fix and 50% after. What improves is ranking. The area under the precision-recall curve rises from 0.79 to 0.93, and at a 2% false-alarm budget recall rises from 8% to 46%, so at any fixed low false-alarm rate the fixed model catches far more. A simple linear model with the right data out-ranks a fine-tuned transformer with the wrong data.
The over-block reproduces across three model classes. The ranking gain reproduces on the two fully-trained models and not on a single-epoch 0.5B decoder, so the line that matters is training budget, not model size.
The same shortcut is a way in
A feature that over-blocks benign skills is also a feature an attacker can borrow. Appending eight of the detector's own benign source-style tokens to a malicious skill pushes it below threshold 17% of the time, against 5% for the same number of random tokens. The payload does not change and the attacker never queries the model. The data fix narrows this to 7% as it narrows the false-positive rate: one bias produces both failures, and one data choice moves both.
It holds outside the benchmark
Curated benign sources could be the whole story, so the last check uses 400 real SKILL.md
files from public GitHub, 32% of which contain the openclaw token. The all-data detector
flags 30% of them as malicious; the fixed one flags 5%. These files are unlabeled, so this measures the
over-block divergence in the wild rather than a calibrated error rate. The benchmark finding is not an
artifact of its curated sources.
What a benchmark should report
Two practices would have surfaced this earlier. Report the benign false-positive rate on unseen sources with the threshold fixed before anyone looks at the test set, because a threshold tuned on training-source validation does not transfer. And state how the malicious and benign examples in each source were built, so a reader can tell whether a detector learned what makes a skill dangerous or learned how the benchmark was assembled.
- Strong numbers on a random split can hide a model that solved an easier problem than the one you care about. Test on held-out sources.
- A source-composition choice beat a fine-tuned transformer here, and a control separated "right data" from "less data."
- The honest version of a result includes its cost. This one trades fixed-threshold recall and does not transfer its ranking gain to an undertrained decoder.
Code, per-skill scores, the paper, and an int8 ONNX scanner are open. The result files behind each number are in the repo's results/ folder.