Office Templates
It's possible to persist in the userland by abusing Microsof templates - documents that are used as base templates for all new documents created by Office. In this lab, I am abusing Ms Word templates.

Weaponization

Let's open and edit the base template called Normal that can be found at:
1
C:\Users\mantvydas\AppData\Roaming\Microsoft\Templates
Copied!
Create a new AutoOpen macro and add your VBA code there:
1
Sub AutoOpen()
2
MsgBox "Ohai from the template :)"
3
End Sub
Copied!
Save the template and exit. We're now ready to create a new document, save it and launch it - at this point, we should get our VBA code executed. Below GIF shows exactly that:

References

Persistence: "the continued or prolonged existence of something": Part 1 - Microsoft Office - MDSec
MDSec
Last modified 2yr ago
Copy link