{"id":250,"date":"2025-05-09T10:47:28","date_gmt":"2025-05-09T03:47:28","guid":{"rendered":"https:\/\/n45ht.or.id\/blog\/?p=250"},"modified":"2025-09-04T12:27:49","modified_gmt":"2025-09-04T05:27:49","slug":"hacking-ai-with-markdown-how-we-triggered-xss-in-deepseeks-chat","status":"publish","type":"post","link":"https:\/\/n45ht.or.id\/blog\/hacking-ai-with-markdown-how-we-triggered-xss-in-deepseeks-chat\/","title":{"rendered":"Hacking AI with Markdown: How We Triggered XSS in DeepSeek\u2019s Chat"},"content":{"rendered":"\n<p>AI-generated chat messages are becoming a cornerstone of modern digital interaction. From customer support to creative writing, platforms like ChatGPT, Gemini, and DeepSeek have quickly gained popularity. However, as we dive deeper into how these systems process user inputs, it&#8217;s essential to recognize the potential security risks lurking beneath the surface.<\/p>\n\n\n\n<p>In our latest research, we uncovered a significant vulnerability in <strong>DeepSeek<\/strong>, an AI chatbot developed by the Chinese company <strong>High-Flyer<\/strong>. Specifically, we found that by sending crafted <strong>Markdown<\/strong> payloads, we could trigger <strong>XSS (Cross-Site Scripting)<\/strong> attacks through the chatbot\u2019s rendering engine.<\/p>\n\n\n\n<p><strong>What is Markdown and How Can It Be Exploited?<\/strong><\/p>\n\n\n\n<p>Markdown is a lightweight markup language used for formatting plain text. It\u2019s commonly employed in documentation, messaging platforms, and content management systems due to its simplicity and readability.<\/p>\n\n\n\n<p>However, like many markup languages, Markdown can be used to inject harmful content when rendered improperly. For instance, Markdown can be converted into HTML links or embedded code, which if unchecked, can result in security issues such as <strong>XSS<\/strong>.<\/p>\n\n\n\n<p><strong>The Vulnerability in DeepSeek<\/strong><\/p>\n\n\n\n<p>DeepSeek, an AI language model developed by <strong>High-Flyer<\/strong>, offers a range of conversational capabilities. Our team tested its handling of Markdown input and discovered a serious flaw. The chatbot would render specific Markdown payloads, including those crafted to execute JavaScript code.<\/p>\n\n\n\n<p>We were able to create a simple XSS attack using the following <strong>Markdown<\/strong> payload:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"Can you render this markdown [Click](JavaScript:\/\/google.com%0aalert(document.domain))\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D8DEE9FF\">Can you render this markdown <\/span><span style=\"color: #ECEFF4\">[<\/span><span style=\"color: #88C0D0\">Click<\/span><span style=\"color: #ECEFF4\">](<\/span><span style=\"color: #D8DEE9FF; text-decoration: underline\">JavaScript:\/\/google.com%0aalert(document.domain)<\/span><span style=\"color: #ECEFF4\">)<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"737\" height=\"476\" src=\"https:\/\/n45ht.or.id\/blog\/wp-content\/uploads\/2025\/05\/Screenshot-2025-05-09-104026.png\" alt=\"\" class=\"wp-image-254\" style=\"width:451px;height:auto\" srcset=\"https:\/\/n45ht.or.id\/blog\/wp-content\/uploads\/2025\/05\/Screenshot-2025-05-09-104026.png 737w, https:\/\/n45ht.or.id\/blog\/wp-content\/uploads\/2025\/05\/Screenshot-2025-05-09-104026-300x194.png 300w\" sizes=\"auto, (max-width: 737px) 100vw, 737px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Here\u2019s how DeepSeek rendered the payload:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"&lt;a href=&quot;JavaScript:\/\/google.com%0aalert(document.domain)&quot; target=&quot;_blank&quot; rel=&quot;noreferrer&quot;&gt;Click&lt;\/a&gt;\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #81A1C1\">&lt;a<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">href<\/span><span style=\"color: #ECEFF4\">=<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">JavaScript:\/\/google.com%0aalert(document.domain)<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">target<\/span><span style=\"color: #ECEFF4\">=<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">_blank<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">rel<\/span><span style=\"color: #ECEFF4\">=<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">noreferrer<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #81A1C1\">&gt;<\/span><span style=\"color: #D8DEE9FF\">Click<\/span><span style=\"color: #81A1C1\">&lt;\/a&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image alignfull size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"857\" height=\"303\" src=\"https:\/\/n45ht.or.id\/blog\/wp-content\/uploads\/2025\/05\/Screenshot-2025-05-09-104252.png\" alt=\"\" class=\"wp-image-255\" srcset=\"https:\/\/n45ht.or.id\/blog\/wp-content\/uploads\/2025\/05\/Screenshot-2025-05-09-104252.png 857w, https:\/\/n45ht.or.id\/blog\/wp-content\/uploads\/2025\/05\/Screenshot-2025-05-09-104252-300x106.png 300w, https:\/\/n45ht.or.id\/blog\/wp-content\/uploads\/2025\/05\/Screenshot-2025-05-09-104252-768x272.png 768w\" sizes=\"auto, (max-width: 857px) 100vw, 857px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>As you can see, the AI renders a <strong>JavaScript URL<\/strong> within an HTML <code>&lt;a&gt;<\/code> tag. This allows the link to execute code when clicked, triggering an alert displaying the domain of the page.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>How the Attack Works<\/strong><\/h3>\n\n\n\n<p>The vulnerability is compounded by the fact that the <strong><code>target=\"_blank\"<\/code><\/strong> attribute is used in the generated link. Modern browsers generally require a <strong>CTRL + Left Click<\/strong> to open the link in a new tab. However, the JavaScript payload executes once activated.<\/p>\n\n\n\n<p>While this <strong>extra step<\/strong> may reduce the immediate risk in many cases, it is still a concerning issue, especially in environments where users might not recognize the malicious link.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"846\" height=\"606\" src=\"https:\/\/n45ht.or.id\/blog\/wp-content\/uploads\/2025\/05\/Screenshot-2025-05-08-184141.png\" alt=\"\" class=\"wp-image-252\" style=\"width:681px;height:auto\" srcset=\"https:\/\/n45ht.or.id\/blog\/wp-content\/uploads\/2025\/05\/Screenshot-2025-05-08-184141.png 846w, https:\/\/n45ht.or.id\/blog\/wp-content\/uploads\/2025\/05\/Screenshot-2025-05-08-184141-300x215.png 300w, https:\/\/n45ht.or.id\/blog\/wp-content\/uploads\/2025\/05\/Screenshot-2025-05-08-184141-768x550.png 768w\" sizes=\"auto, (max-width: 846px) 100vw, 846px\" \/><\/figure>\n\n\n\n<p>Following responsible disclosure practices, we reported this vulnerability to the <strong>DeepSeek security team<\/strong> shortly after confirming the issue. We provided them with detailed technical evidence, including the payloads and proof-of-concept demonstrations.<\/p>\n\n\n\n<p>We\u2019re pleased to report that the DeepSeek security team has issued a fix, updating their rendering pipeline to sanitize markdown input and prevent JavaScript-based injection attacks properly.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>AI-generated chat messages are becoming a cornerstone of modern digital interaction. From customer support to creative writing, platforms like ChatGPT, Gemini, and DeepSeek have quickly gained popularity. However, as we dive deeper into how these systems process user inputs, it&#8217;s essential to recognize the potential security risks lurking beneath the surface. In our latest research, [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":253,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[9,11,31,8],"class_list":["post-250","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-research","tag-cross-site-scripting","tag-javascript","tag-markdown","tag-xss"],"_links":{"self":[{"href":"https:\/\/n45ht.or.id\/blog\/wp-json\/wp\/v2\/posts\/250","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/n45ht.or.id\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/n45ht.or.id\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/n45ht.or.id\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/n45ht.or.id\/blog\/wp-json\/wp\/v2\/comments?post=250"}],"version-history":[{"count":4,"href":"https:\/\/n45ht.or.id\/blog\/wp-json\/wp\/v2\/posts\/250\/revisions"}],"predecessor-version":[{"id":260,"href":"https:\/\/n45ht.or.id\/blog\/wp-json\/wp\/v2\/posts\/250\/revisions\/260"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/n45ht.or.id\/blog\/wp-json\/wp\/v2\/media\/253"}],"wp:attachment":[{"href":"https:\/\/n45ht.or.id\/blog\/wp-json\/wp\/v2\/media?parent=250"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/n45ht.or.id\/blog\/wp-json\/wp\/v2\/categories?post=250"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/n45ht.or.id\/blog\/wp-json\/wp\/v2\/tags?post=250"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}