You are browsing the archive for Autostart (Persistence).

Beyond good ol’ Run key, Part 64

July 12, 2017 in Anti-*, Autostart (Persistence), Compromise Detection, Forensic Analysis

I recently updated my ‘collect all cool persistence mechanism described elsewhere’ post. After I announced it on Twitter, 3gstudent replied with one more link – one that led to his demo of persistence via bitsadmin. I looked at BITS before, but it never occurred to me to look at all command line options of the bitsadmin tool – the fact it allows persistence was a nice surprise. It intrigued me that it was not recognized by autoruns.

I immediately tested the mechanism on a Win7 VM and quickly discovered that the BITS stores info about tasks inside the following location:

  • c:\ProgramData\Microsoft\Network\Downloader\qmgr0.dat
  • c:\ProgramData\Microsoft\Network\Downloader\qmgr1.dat

Sometimes you may find also qmgr0.bak & qmgr1.bak files there.

I have ran a test adding as many tasks as possible and noticed that the only visible difference is growth of the file size of both files. After the first test the files on my system were around 4MiB (Win7). Adding new tasks eventually made BITS run out of space – at that time it simply extends the file.

Googling around for these file names doesn’t provide that much info. The format of the file is unknown – some serialized data.

One thing is sure though –  if you come across these during the exam, you should defo look at possible BITS persistence.

Beyond good ol’ Run key, Part 62

April 19, 2017 in Anti-Forensics, Autostart (Persistence), Compromise Detection, Forensic Analysis, Incident Response, Malware Analysis


This is not an RCE. If it was, I would not publish it on this blog 🙂

Turns out “Simpsons already did it” and as pointed out by @arekfurt a normal template-based persistence is already implemented in EmpireProject and is based on awesome work of @enigma0x3. Interestingly, enabling macros is not needed to deliver the same functionality (as explained below).

Dropping any macro sheet inside the XLSTART folder and opening it from there will not show the macro warning 🙂

Old Post

Every once in a while we come across weird things that we not only discover accidentally, but are finding hard to understand. Today I was playing around with Word Macros and to my surprise I was able to accidentally run one, while my Macro Options were set to Disable all macros with notification.

Intrigued, I quickly realized that instead of adding it to a test word document, I accidentally added it to the normal template file.

Could it be… ?

I rushed to add the AutoOpen macro to the normal template that will launch the Calculator anytime the template is used:

Now I only needed to open some word document…

How nice!

Interestingly, the Security Warning appears ONLY after I visit options while the document is open.

Swap calculator with anything else, and a new stealth persistence mechanism is born…

Now, what about Excel?

Excel doesn’t have the Normal template equivalent by default, but you can add one. To do so, you just need to record any macro named Auto_Open and store it inside a personal template (by choosing ‘Store macro in Personal Macro Workbook‘):

(alternatively, you can create a personal template directly on the system by placing a prepared XLSB file in a following location: c:\Users\<USER>\AppData\Roaming\Microsoft\Excel\XLSTART\PERSONAL.XLSB)

Then switch to the macro editor, and write the code as below:

This will ensure the Calculator will be executed anytime someone opens Excel, even if the macros are *cough* *cough* disabled…