Back to articles

Reverse Engineering

Reverse Engineering Extensible Storage Engine (ESE) Database File

In June 2020 BSides TLV hosted a Capture the Flag Event which comprised of various Challenges segregated with multiple categories such as Reverse Engineering, Web, Cryptography, etc.

The Target was a Miscellaneous challenge which consisted Reverse Engineering of the file.

After Downloading it we would run File Command against TheTarget to know its file type:

root@rootsploit# file TheTarget
TheTarget: Extensible storage engine DataBase, version 0x620, checksum 0x54fcc144, page size 8192, Windows version 6.3

Extensible Storage Engine (ESE) is an advanced indexed and sequential access method (ISAM) storage technology. ESE enables applications to store and retrieve data from tables using indexed or sequential cursor navigation. It is usually utilized by various Microsoft Services such as Microsoft Exchange Server, Active Directory, and Windows Search.

If you have Red Teaming Experience you’d be familiar with NTDS.dit file which is a database file (ESE) which stored Active Directory Data including User Objects, Groups and Group Members and Password hashes for all users in the domain.

To extract the Contents of the file we will be using libesedb from Github.

Installing libesedb:

Download Libesedb from Github releases page

wget https://github.com/libyal/libesedb/releases/download/20200418/libesedb-experimental-20200418.tar.gz/

Now Extract with tar command,

tar xvf libesedb-experimental-20200418.tar.gz

Install Dependencies for libesedb.

sudo apt-get install autoconf automake autopoint libtool pkg-config

Configure and Install libesedb

cd libesedb-20200418
./configure
make
sudo make install
sudo ldconfig

Dumping Data:

esedbexport -m tables TheTarget

After running esedbexport module from libesedb which would extract all in exported folder.

Analyzing Dumped Data:

Extracted ESE File

After analyzing the contents file database.4 we can open the file in Visual Studio Code or any other editor instead of using notepad or cat command on terminal considering the number of lines of the file.

Extracted Database File

And here we have our flag but for further analysis ntdsxtract tool can used to gather hashes of the Active Directory users which will be covered in further blogs.

Summary:

Microsoft Active Directory and various other services make use of Extensible Storage Engine (ESE) for storing data and can be reverse engineered by an attacker to compromise Domain Admin Credentials this challenge can be useful in Red Teaming Activities as well.

Stay tuned for more updates:

Website: https://rootsploit.com/

Twitter : https://twitter.com/rootsploit/.

References: