Repository navigation
Jint 4.18.2 is a security release from the 4.x branch. It fixes three vulnerabilities reported privately, and every application that runs untrusted or semi-trusted JavaScript should upgrade. It adds no new public API, but each fix changes something a script or host can observe; What might change for you below lists those changes.
Security fixes
Script could reach System.Type from an ordinary projected object and invoke any .NET method (GHSA-w2w8-h26g-7qx3, critical, reported by @Jerra94). A default engine exposing nothing more than an empty Dictionary<string, object> let script obtain a System.Type and use it to start a process, with AllowClr off and AllowGetType/AllowSystemReflection false. Two of the steps are closed here:
- A wrapped CLR object no longer resolves the public nested types of its class.
- A type reference inside an array or object crosses to the host as a function, as a bare one already did, never as its
System.Type.
A projected System.Type exposed Type.InvokeMember (GHSA-7m9w-cr38-h9m8, high, reported and fixed by @michaelthyregod). Script holding any Type that a host projected could invoke arbitrary CLR members by reflection, whatever the reflection options said. While Interop.AllowSystemReflection is off, which is the default, the members that invoke or instantiate through reflection are now hidden. These are InvokeMember, Invoke, CreateInstance, CreateDelegate, GetValue/SetValue and MakeGenericType/MakeGenericMethod. They are hidden on Type and the other reflection types, including the copies reached through IReflect and the .NET Framework COM mirror interfaces.
Built-in string operations threw a raw .NET exception that escaped the engine (GHSA-7rgm-vqmm-jh8x, moderate, reported by @bl4ckw4t3r-sec). The exception went past a host's catch (JavaScriptException), past CatchClrExceptions() and past the script's own try/catch.
String.prototype.normalizenow normalizes the string as the code points ECMAScript reads it as: a lone surrogate or U+FFFE stays in place and the text around it is normalized, so'\uD800'.normalize()is'\uD800'.localeCompare,Intl.Collator.prototype.compareand asortgiven that comparator normalize the same way.toLocaleUpperCase('lt')keeps a U+0307 COMBINING DOT ABOVE that starts the string.
What might change for you
- A nested type read through an instance (
instance.Nested) is nowundefined. Read it from its declaring type's type reference instead,SomeType.Nested, throughTypeReference.CreateTypeReferenceorimportNamespace; that path is unchanged. - A type reference that script passes inside an array or an object, such as
host.Put([SomeType]), reaches the host as a callable delegate rather than as aSystem.Type. - A projected
System.Typekeeps its ordinary members (Name,FullName,IsAbstract, …), but its reflection-invocation members readundefinedunlessInterop.AllowSystemReflectionis set totrue. normalize,localeCompareandIntl.Collatorreturn a result for strings holding a lone surrogate or U+FFFE, where they used to throw.