probe: token-length side-channel (#570)#1909
Open
neerazz wants to merge 1 commit into
Open
Conversation
Adds a side_channel module with a TokenLength probe and a TokenLengthLeak detector that estimates how much a response would leak through the streamed token-length side channel described by Weiss et al. (2024). The detector scores each output by the coefficient of variation of its token lengths; near-uniform lengths (e.g. a padded serving path) score low, highly varied lengths score high. Probe ships inactive at INFORMATIONAL tier as a first, tight-scope increment. Includes unit tests and docs. Closes NVIDIA#570 Signed-off-by: Neeraj Kumar Singh <b.nirajkumarsingh@hotmail.com>
Contributor
Author
|
Ready for maintainer review. I tightened the PR description so this is no longer framed as exploratory/draft. The branch is pushed and DCO is green. I also re-ran the focused local tests: python3 -m pytest tests/detectors/test_detectors_side_channel.py tests/probes/test_probes_side_channel.py -q
# 8 passed in 0.59sThe only thing I can see blocking merge now is maintainer review / any repository-side CI that maintainers want to trigger on this fork PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements #570 (probe: token-length side-channel).
What this adds
garak/probes/side_channel.py—TokenLengthprobe. Elicits short, structured, sensitive-shaped answers whose length signature is the interesting part.garak/detectors/side_channel.py—TokenLengthLeakdetector. Scores each output by the coefficient of variation of token-like output segment lengths, normalised to 0.0–1.0. A response with near-uniform token lengths scores low; a response with highly varied lengths scores high. This follows the observation from Weiss et al. 2024 ("What Was Your Prompt?", arXiv:2403.09751) and the Cloudflare write-up that the entropy of token-length sequences is what an eavesdropper can recover from encrypted packet sizes.The probe ships
active = FalseatINFORMATIONALtier so it is available for targeted use without changing default probe behavior.Implementation notes
owasp:llm06,avid-effect:security:S0301,quality:Security:Confidentiality.Verification
python3 -m pytest tests/detectors/test_detectors_side_channel.py tests/probes/test_probes_side_channel.py -q8 passed in 0.59s