Commit edb1934
committed
Fixed code execution vulnerability due to Object coercion
refs GHSA-jqv5-7xpx-qj74
fixes https://github.com/TryGhost/Toolbox/issues/491
- when you call `ToString()` on `Napi::Value`, it calls
`napi_coerce_to_string` underneath, which has the ability to run
arbitrary JS code if the passed in value is a crafted object
- both remote code execution or denial-of-service are possible via
this vulnerability
- `toString()` on an Object returns `[object Object]` so instead of
calling the function, we're going to hardcode it to prevent this
issue
Credits: Dave McDaniel of Cisco Talos1 parent 3a48888 commit edb1934
2 files changed
+17
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
211 | | - | |
| 211 | + | |
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
98 | 114 | | |
0 commit comments