Cloudflare

Mitigating a token-length side-channel attack in our AI products

Mar 14, 2024Celso Martinho, Michelle Chen
Mitigating a token-length side-channel attack in our AI products
SummaryAI, from the source post

Implemented a mitigation for a token-length side-channel attack affecting streaming AI responses by adding a 'p' property with a variable-length random string to JSON objects in streaming responses. This obfuscates the actual token length, preventing attackers from inferring information from network packet lengths. This mitigation is applied automatically to both Workers AI and AI Gateway.

More from the Artificial Intelligence Integration & Impact trail