githubEdit

Pillaging

What’s Pillaging ?

Pillaging is the process of obtaining information from a compromised system. It can be personal information, corporate blueprints, credit card data, server information, infrastructure and network details, passwords, or other types of credentials, and anything relevant to the company or security assessment we are working on.

Scenario

Let's assume that we have gained a foothold on the Windows server mentioned in the below network and start collecting as much information as possible.

image.png

Installed Applications

Understanding which applications are installed on our compromised system may help us achieve our goal during a pentest.

We will also find typical applications such as Office, remote management systems, IM clients, etc. We can use dir or ls to check the content of Program Files and Program Files (x86) to find which applications are installed

Identifying Common Applications

use PowerShell and read the Windows registry

We can see the mRemoteNG software is installed on the system. mRemoteNGarrow-up-right is a tool used to manage and connect to remote systems using VNC, RDP, SSH, and similar protocols. Let's take a look at mRemoteNG.

mRemoteNG

mRemoteNG saves connection info and credentials to a file called confCons.xml. They use a hardcoded master password, mR3m, so if anyone starts saving credentials in mRemoteNG and does not protect the configuration with a password, we can access the credentials from the configuration file and decrypt them.

By default, the configuration file is located in %USERPROFILE%\APPDATA\Roaming\mRemoteNG.

Discover mRemoteNG Configuration Files

Display confCons.xml

Those nodes contain details about the remote system, such as username, domain, hostname, protocol, and password

Connections with the information about the encryption used for the credentials and the attribute Protected, which corresponds to the master passord used to encrypt the document

Decrypt the Password with mremoteng_decrypt

Decrypt With master password

if we try to decrypt password with usually way we notice the error occur so we assume we know master password and we will try to decrypt using it

For Loop to Crack the Master Password with mremoteng_decrypt


Abusing Cookies to Get Access to IM Clients

instant messaging (IM) applications like Slack and Microsoft Teams we will try to get cookies for slack App

Firefox saves the cookies in an SQLite database in a file named cookies.sqlite. This file is in each user's APPDATA directory %APPDATA%\Mozilla\Firefox\Profiles\<RANDOM>.default-release

Copy Firefox Cookies Database

we will try to copy cookies.sqlite database in our device

Python script cookieextractor.pyarrow-up-right to extract cookies from the Firefox cookies.SQLite database.

Now that we have the cookie, we can use any browser extension to add the cookie to our browser.

we use extension Cookie-Editorarrow-up-right to add cookies

The chromium-based browser also stores its cookies information in an SQLite database. The only difference is that the cookie value is encrypted with Data Protection API (DPAPI)arrow-up-right. DPAPI is commonly used to encrypt data using information from the current user account or computer.

PowerShell Script - Invoke-SharpChromium

SharpChromium search on sqlite in default path %LOCALAPPDATA%\Google\Chrome\User Data\Default\Cookies but the actual file is located in %LOCALAPPDATA%\Google\Chrome\User Data\Default\Network\Cookies with the following command we will copy the file to the location SharpChromium is expecting.

Copy Cookies to SharpChromium Expected Location

Invoke-SharpChromium Cookies Extraction


Clipboard

Monitor the Clipboard with PowerShell

We can use the Invoke-Clipboardarrow-up-right script to extract user clipboard data. Start the logger by issuing the command below.


Roles and Services

Typical server roles and services include: File and Print Servers, Web and Database Servers, Backup Servers

Let's take Backup Servers as an example, and how, if we compromise a server or host with a backup system, we can compromise the network.

Attacking Backup Servers

Restic is a modern backup program that can back up files in Linux, BSD, Mac, and Windows.

We will use restic 0.13.1 and back up the repository C:\xampp\htdocs\webapp in E:\restic\ directory. To download the latest version of restic, visit https://github.com/restic/restic/releases/latestarrow-up-right. On our target machine, restic is located at C:\Windows\System32\restic.exe.

We first need to create and initialize the location where our backup will be saved, called the repository.

restic - Initialize Backup Directory

Then we can create our first backup.

restic - Back up a Directory

If we want to back up a directory such as C:\Windows, which has some files actively used by the operating system, we can use the option --use-fs-snapshot to create a VSS (Volume Shadow Copy) to perform the backup.

restic - Back up a Directory with VSS

restic - Check Backups Saved in a Repository

restic - Restore a Backup with ID

Last updated