Summary
Yomitan dictionaries may include a CSS stylesheet file, styles.css. If HTML is written in this file, then Anki flashcards created from the dictionary data will contain this markup in a non-sanitized format. Opening such flashcards in Anki will cause the markup to render and embedded <script> blocks to execute.
Details
styles.css functionality was added in PR #1080
The text content of the styles.css file (loaded from a dictionary ZIP archive) is set to the textContent property of a style node within the Yomitan popup. This prevents any HTML text from being rendered within the browser by the Yomitan web extension. However, when this text is sent to Anki during flashcard creation, it is not sanitized in a similar manner.
PoC
Example styles.css
span[data-sc-content="registered-symbol"] {
vertical-align: super;
font-size: 0.6em;
}
div[data-sc-content="attribution"] {
font-size: 0.7em;
text-align: right;
}
</style>
<script>
alert("hello");
</script>
<style>
Dictionary file with this stylesheet: malicious_dictionary.zip
Steps to reproduce:
- Install latest versions of Anki, Yomitan, AnkiConnect
- Import malicious dictionary into Yomitan
- Setup Anki Card template in Yomitan, setting Deck to "Default," Model to "Basic," Front to "{expression}" and Back to "{glossary}"
- Create an Anki flashcard for the term 付箋
- Open the "Default" deck to review the newly created card in Anki. Click the "Show Answer button," and observe the "hello" JavaScript alert as Anki renders the card's glossary.
Image of "hello" popup in Anki

Impact
Anki flashcards are displayed in a sandbox, and the potential for harm is generally understood to be low. User-created Anki flashcard decks are commonly shared online and often contain JavaScript code. So the likelihood of a maliciously crafted Yomitan dictionary causing harm through this route is probably low. However, the behavior doesn't seem to be expected or desirable.
Summary
Yomitan dictionaries may include a CSS stylesheet file,
styles.css. If HTML is written in this file, then Anki flashcards created from the dictionary data will contain this markup in a non-sanitized format. Opening such flashcards in Anki will cause the markup to render and embedded<script>blocks to execute.Details
styles.cssfunctionality was added in PR #1080The text content of the
styles.cssfile (loaded from a dictionary ZIP archive) is set to the textContent property of a style node within the Yomitan popup. This prevents any HTML text from being rendered within the browser by the Yomitan web extension. However, when this text is sent to Anki during flashcard creation, it is not sanitized in a similar manner.PoC
Example styles.css
Dictionary file with this stylesheet: malicious_dictionary.zip
Steps to reproduce:
Image of "hello" popup in Anki
Impact
Anki flashcards are displayed in a sandbox, and the potential for harm is generally understood to be low. User-created Anki flashcard decks are commonly shared online and often contain JavaScript code. So the likelihood of a maliciously crafted Yomitan dictionary causing harm through this route is probably low. However, the behavior doesn't seem to be expected or desirable.