
CVE-2026-30691: البرمجة النصية عبر المواقع المخزنة (XSS) في @cyntler/react-doc-viewer
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
[Suggested description]
Cross-Site Scripting (XSS) vulnerability in @cyntler/react-doc-viewer v1.17.1 allows remote attackers to execute arbitrary JavaScript via a crafted .txt file. The TXTRenderer component fails to sanitize file content and explicitly casts raw data as a ReactNode.
[Additional Information]
"The TXTRenderer is used by default for any text-based files. Since the library is widely used in React applications to preview user-uploaded content, this vulnerability poses a significant risk for applications that do not strictly validate file contents before passing them to the viewer."
[Vulnerability Type] Cross Site Scripting (XSS)
[Vendor of Product] cyntler
[Affected Product Code Base] @cyntler/react-doc-viewer - 1.17.1
[Affected Component] src/renderers/txt/index.tsx
[Attack Type] Remote
[Impact Code execution] true
[Impact Information Disclosure] true
[Attack Vectors]
"An attacker must provide a specially crafted .txt file containing malicious HTML or JavaScript code. When the victim opens this file using the DocViewer component, the script executes in their browser."
[Reference] https://github.com/cyntler/react-doc-viewer/issues/317
[Discoverer] Walid Riouah
Use CVE-2026-30691.
-----BEGIN PGP SIGNATURE-----
-----END PGP SIGNATURE-----
تم تحديد ثغرة Cross-Site Scripting (XSS) مخزنة في حزمة @cyntler/react-doc-viewer (الإصدار 1.17.1). توجد الثغرة في مكوّن TXTRenderer، الذي يعرض محتوى الملف الخام من ملفات .txt عن طريق تحويله صراحةً إلى ReactNode دون أي تنظيف مسبق أو ترميز للكيانات.
في src/renderers/txt/index.tsx:
{currentDocument?.fileData as ReactNode}
لإعادة إنتاج الثغرة، أنشئ ملفًا باسم exploit.txt يحتوي على الحمولة البرمجية الصريحة التالية وقم بتحميله في مكوّن عارض المستندات:
<h1 style="color: red;">Vulnerable!</h1>
<script>alert('XSS_SUCCESS'); document.body.style.background='red';</script>
<img src=x onerror="console.log('XSS_Executed_Successfully')">
يمكن للمهاجم تنفيذ JavaScript تعسفي في سياق متصفح الضحية. قد يؤدي ذلك إلى:
قم بتنظيف إدخال النص الديناميكي باستخدام مكتبة تنظيف HTML مثل DOMPurify قبل العرض، أو تجنّب التحويل غير الآمن لمدخلات السلاسل النصية الخام إلى كائنات ReactNode:
import DOMPurify from 'dompurify';
const sanitizedHTML = DOMPurify.sanitize(currentDocument?.fileData);
return <div dangerouslySetInnerHTML={{ __html: sanitizedHTML }} />;
أُعدّت هذه الاستشارة بواسطة Walid Riouah (باحث في الأمن السيبراني وخبير في الفريق الأحمر)