14. Attacking thick applications

Thick client apps are apps installed locally on our computers. Unlike client apps that run on a remote server that can be accessed through web browsers, these apps do not require internet to run and perform better in processing power / memory / storage capacity.

Thick clients are usually applications used in enterprise environments created to serve specific purposes.

Critical security measure that for example Java has is sandbox

Aside from these are Java API restrictions and code signing that help security

In .NET

Examples of thick clients:

Some thick client applications are usually available to purchase or download for free through official website or 3p - some other custom apps have been created for a specific company and can be delivered from it dept Maintaining and deploying thick clients more difficult than thin - updates must be done locally to user's computer.

Two tier thick clients:

Three tier thick clients:

App server / DB may be located in same network or over internet. This helps three-tier thick apps more secure since attackers wouldn't communicate directly with db.

Large portion of thick apps are downloaded from internet - no sufficient way to ensure all users download the official application Web specific vulns do not apply to thick apps. Although, thick considered less secure than webapps with many attacks being applicable:


Thick application - penetration testing steps

Attack surface can be large. Both automated and manual steps to leverage

Information gathering

Tools: https://ntcore.com/?page_id=388 - CFF Explorer https://github.com/horsicq/Detect-It-Easy - Detect It Easy https://learn.microsoft.com/en-us/sysinternals/downloads/procmon - Process Monitor https://learn.microsoft.com/en-us/sysinternals/downloads/strings - strings

Clientside attacks Thick clients perform significant processing + data storage on clientside, but still comm with servers (synchronization, shared resources) This interaction exposes thick to vulns found in webapps like cmd inj, weak access control, sqli Sensitive info like users, passwords, token or strings for communication with other services may be stored in application's local files. Hardcoded credentials and other sensitive information can also be found in application source code. Static analysis is a necessary step while testing the application. Using proper tools, rev-eng and examine a .net / java app using EXE, DLL, JAR, CLASS, WAR / other formats. Dynamic analysis should also be performed, thick clients store sensitive info in memory as well

|Ghidra|IDA|OllyDbg|Radare2| |dnSpy|x64dbg|JADX|Frida|

Network side attacks If app communicates with a local or remote server, network traffic analysis can help us capture sensitive information that might be transferred through HTTP/HTTPS or TCP/UDP connections and give us a better understanding of how the application is working. Pentesters that perform traffic analysis on thick client apps should be familiar with tools like: |Wireshark|tcpdump|TCPView|Burp Suite|

Server-side Similar to web app attacks - OWASP top ten.


Retrieving hardcoded credentials from a thick application

Take given scenario. Exploring NETLOGON share of SMB svc reveals RestartOracle-Service.exe among other filers. Downloading the executable locally and running it through command line, seems like it does not run or runs something hidden

Taking a look through ProcMon64 from sysinternals and monitoring the process reveals the executable creates a temp file for example: C:\Users\Matt\AppData\Local\Temp

![](/img/Pasted image 20250118144722.png)

In order to capture the files it's required to change the permissions of Temp to disallow file deletions. Properties -> Security -> Advanced -> [username] -> Disable Inheritance -> Convert inherited permissions into explicit permissions on this object -> Edit -> Show advanced permissions -> de-select Delete subfolders and files, -> and Delete checkboxes

Re-run EXE and nav to the temp location.

Example generated file:

@shift /0
@echo off

if %username% == matt goto correcto
if %username% == frankytech goto correcto
if %username% == ev4si0n goto correcto
goto error

:correcto
echo TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA > c:\programdata\oracle.txt
echo AAAAAAAAAAgAAAAA4fug4AtAnNIbgBTM0hVGhpcyBwcm9ncmFtIGNhbm5vdCBiZSBydW4g >> c:\programdata\oracle.txt
<SNIP>
echo AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA >> c:\programdata\oracle.txt

echo $salida = $null; $fichero = (Get-Content C:\ProgramData\oracle.txt) ; foreach ($linea in $fichero) {$salida += $linea }; $salida = $salida.Replace(" ",""); [System.IO.File]::WriteAllBytes("c:\programdata\restart-service.exe", [System.Convert]::FromBase64String($salida)) > c:\programdata\monta.ps1
powershell.exe -exec bypass -file c:\programdata\monta.ps1
del c:\programdata\monta.ps1
del c:\programdata\oracle.txt
c:\programdata\restart-service.exe
del c:\programdata\restart-service.exe

content of file reveals:

basically make dir readonly (script doesnt cleanup) follow what is created by the script, manually create executable by running powershell script it creates from above correcto: function (its essentially dropping b64 encoded payload into a .txt file and the ps1 script uses that .txt to create another .exe) then we open that .exe in x64dbg to inspect what its doing. options -> preferences -> exit breakpoint as only options checked

![](/img/Pasted image 20250118151144.png)

rightclick inside cpu view and select 'follow in memory map'

![](/img/Pasted image 20250118151243.png)

checking memory maps at this stage of exec

Checking the memory maps at this stage of the execution, of particular interest is the map with a size of 0000000000003000 with a type of MAP and protection set to -RW--.

memory-mapped files allow applications to access large files without having to read or write entire file into memory at once. instead file is mapped to region of memory that the application can r/w as if it were regular buffer of memory. this is a place to look for potentially hardcoded credentials. following this memory map we see magic bytes MZ in ascii columns indicating the file is a DOS MZ executable

![](/img/Pasted image 20250118151858.png)

![](/img/Pasted image 20250118151913.png)

why this particular memory map? how to find it yourself? not sure! maybe outside scope of the module itself.

![](/img/Pasted image 20250118152047.png)

![](/img/Pasted image 20250118152237.png)

![](/img/Pasted image 20250118152314.png)

that sure looks like a password

Reading output reveals the dump contains a .NET executable ![](/img/Pasted image 20250118152359.png)

We can use de4dot to reverse the .NET back into source code by dragging our bin file onto the de4dot executable

![](/img/Pasted image 20250118152516.png)

now we can read teh source code of the exported application by dragging/dropping this cleaned bin onto DnSpy

![](/img/Pasted image 20250118152617.png) ![](/img/Pasted image 20250118152700.png)


Attacking web vulnerabilities in a thick client application

Three-tier architectures have security advantage over two tiers since it prevents the end user from communicating directly with the database server - but these can still be susceptible to webspecific attacks like sqli and path traversal

Common to encounter thick client apps that connect to a server to communicate with a database. Assume you've found the below files enumerating an FTP server that provides anonymous user access:

Content of these reveal:

fatty-client.jar

![](/img/Pasted image 20250118171203.png) connection fails. probably due to port 1337 instead of 8000 above. extract jar file and search strings for 8000

![](/img/Pasted image 20250118171231.png)

when we modify the xml file you need to make sure the sha-256 digest matches. if you try to simply modify and re-run it will fail because the JAR is signed. (every files sha-256 hash is validated before running)

remove all hashes and delete 1.rsa and 1.sf from meta-inf. manifest.mf should end with a newline

update and run the jar:

C:\> cd .\fatty-client
C:\> jar -cmf .\META-INF\MANIFEST.MF ..\fatty-client-new.jar *

![](/img/Pasted image 20250118171815.png) now we can communicate with the backend

Recompiling a JAR after making changes ![](/img/Pasted image 20250118194328.png) open in decompiler file -> save all sources this gives us access to source Java files

make some changes

recompile files:

![](/img/Pasted image 20250118195412.png)

This generates several class files. Let's create a new folder and extract the contents of fatty-client-new.jar into it.

![](/img/Pasted image 20250118200038.png)

Navigate to the raw directory and decompress fatty-client-new-2.jar by right-clicking and selecting Extract Here. Overwrite any existing htb/fatty/client/gui/*.class files with updated class files.

mv -Force fatty-client-new.jar.src\htb\fatty\client\gui\*.class raw\htb\fatty\client\gui\

![](/img/Pasted image 20250118200555.png)

Build new JAR file:

jar -cmf META-INF\MANIFEST.MF traverse.jar .

https://0xdf.gitlab.io/2020/08/08/htb-fatty.html

this section blows. read the writeup above and if you EVER need to decompile/recompile java classes to fuck with and reverse engineer a thick client, use this post for the love of fucking god: https://0xdf.gitlab.io/2020/08/08/jar-files-analysis-and-modifications.html#modifying-compiled-classes