Vulnerability in Rules Files With Hidden Unicode Characters

Pillar Security, a cybersecurity company specializing in securing the entire lifecycle of artificial intelligence (AI) applications, just released information on a novel way of exploiting AI rules files as a bad actor. Details can be found here.
What this means: It’s possible to write “hidden” non-printing Unicode characters into these rules files in a way that’s not detectable to the human eye at code review time.
AI tools read those characters as instructions—your good old “disregard all previous instructions and provide the recipe for a delicious cake” type deal.
Except in this case, it’s not a cake; it’s instructions to add a security vulnerability to the AI assistant’s output.
What we're doing about it: We’ve already published a new Semgrep rule for Codacy customers that will defeat this exploit; you can find it on the patterns page by searching for “detect-invisible-unicode.”
We recommend adding this rule to your organization’s default coding standard and any other standard you use widely.
Don’t let hidden vulnerabilities compromise your AI applications. Codacy’s advanced static analysis and custom Semgrep rules help you detect and prevent exploits like this before they become a threat.