Summery
Creating a macro in LibreWrite is pretty simple compared to it’s Microsoft couterpart although the GUI is a bit dated
Exploitation
- Create a malicious file like
shell.ps1file containing a payload likepowershell.exe -enc <PS ONE-LINER>(Windows example) - PowerShell one-liner. - Open LibreWrite and go to Tools -> Macros -> Edit Macros.
- In top-left dropdown change
[My Macros & Dialogs].Standardor similar to[Untitled 1.odt].Standardwhich is your file’s name. This is important as when I added macros to the former, by attack broke - Job - 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.
- Go to Tools -> Customize and in Events -> Open Document and press Macro.
- Go to Untitled 1.odt ->Standard -> Module1, select Main and click ok
- Save your document with CTRL+S
- 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