Summery

Creating a macro in LibreWrite is pretty simple compared to it’s Microsoft couterpart although the GUI is a bit dated

Exploitation

  1. Create a malicious file like shell.ps1 file containing a payload like powershell.exe -enc <PS ONE-LINER> (Windows example) - PowerShell one-liner.
  2. Open LibreWrite and go to Tools -> Macros -> Edit Macros.
  3. In top-left dropdown change [My Macros & Dialogs].Standard or similar to [Untitled 1.odt].Standard which is your file’s name. This is important as when I added macros to the former, by attack broke - Job
  4. Use one of the LibreWrite macros in the code block and save it with the disk icon. You can compile and run the code if you feel like it.
  5. Go to Tools -> Customize and in Events -> Open Document and press Macro.
  6. Go to Untitled 1.odt ->Standard -> Module1, select Main and click ok
  7. Save your document with CTRL+S
  8. Lastly, run you favorite listener, deliver the payload with swaks, SMB or however you need to and wait for a connection.

References

Used in: Job
0xdf’s usage
Hacktricks’ article
Similar techniques: Restore corrupted office files