math.js remote code execution vulnerability

- AV AC AU C I A
发布: 2025-04-13
修订: 2025-04-13

This article explains in short how we found, exploited and reported a remote code execution (RCE) vulnerability. It is meant to be a guide to finding vulnerabilities, as well as reporting them in a responsible manner. ## Step one: discovery While playing around with [a wrapper](https://github.com/LucentW/s-uzzbot/blob/master/plugins/calculator.lua) of the math.js API (`http://api.mathjs.org/v1/?expr=expression-here`), we discovered that it **appears to evaluate JavaScript**, though with some restrictions: ``` > !calc cos Result: function > !calc eval Result: function > !calc eval("x => x") Error: Value expected (char 3) > !calc eval("console.log") Error: Undefined symbol console > !calc eval("return 1") Result: 1 ``` In particular, it seems that `eval` was replaced with a safe version. `Function` and `setTimeout`/`setInterval` didn't work, either: ``` > !calc Function("return 1") Error: Undefined symbol Function > !calc setTimeout Error: Undefined symbol Function ``` ## Step two:...

0%
暂无可用Exp或PoC
当前有0条受影响产品信息