All Projects → bytecode77 → living-off-the-land

bytecode77 / living-off-the-land

Licence: BSD-2-Clause license
Fileless attack with persistence

Programming Languages

C++
36643 projects - #6 most used programming language
C#
18002 projects
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to living-off-the-land

Peiqi Wiki Poc
鹿不在侧,鲸不予游🐋
Stars: ✭ 179 (+5.29%)
Mutual labels:  poc
Ary
Ary 是一个集成类工具,主要用于调用各种安全工具,从而形成便捷的一键式渗透。
Stars: ✭ 241 (+41.76%)
Mutual labels:  poc
cansecwest2017
No description or website provided.
Stars: ✭ 63 (-62.94%)
Mutual labels:  poc
Pub
Vulnerability Notes, PoC Exploits and Write-Ups for security issues disclosed by tintinweb
Stars: ✭ 217 (+27.65%)
Mutual labels:  poc
Awesome Cve Poc
✍️ A curated list of CVE PoCs.
Stars: ✭ 2,812 (+1554.12%)
Mutual labels:  poc
dheater
D(HE)ater is a proof of concept implementation of the D(HE)at attack (CVE-2002-20001) through which denial-of-service can be performed by enforcing the Diffie-Hellman key exchange.
Stars: ✭ 142 (-16.47%)
Mutual labels:  poc
Ladon
大型内网渗透扫描器&Cobalt Strike,Ladon8.9内置120个模块,包含信息收集/存活主机/端口扫描/服务识别/密码爆破/漏洞检测/漏洞利用。漏洞检测含MS17010/SMBGhost/Weblogic/ActiveMQ/Tomcat/Struts2,密码口令爆破(Mysql/Oracle/MSSQL)/FTP/SSH(Linux)/VNC/Windows(IPC/WMI/SMB/Netbios/LDAP/SmbHash/WmiHash/Winrm),远程执行命令(smbexec/wmiexe/psexec/atexec/sshexec/webshell),降权提权Runas、GetSystem,Poc/Exploit,支持Cobalt Strike 3.X-4.0
Stars: ✭ 2,911 (+1612.35%)
Mutual labels:  poc
exprolog
ProxyLogon Full Exploit Chain PoC (CVE-2021–26855, CVE-2021–26857, CVE-2021–26858, CVE-2021–27065)
Stars: ✭ 131 (-22.94%)
Mutual labels:  poc
Spectrepoc
Proof of concept code for the Spectre CPU exploit.
Stars: ✭ 239 (+40.59%)
Mutual labels:  poc
PocList
Alibaba-Nacos-Unauthorized/ApacheDruid-RCE_CVE-2021-25646/MS-Exchange-SSRF-CVE-2021-26885/Oracle-WebLogic-CVE-2021-2109_RCE/RG-CNVD-2021-14536/RJ-SSL-VPN-UltraVires/Redis-Unauthorized-RCE/TDOA-V11.7-GetOnlineCookie/VMware-vCenter-GetAnyFile/yongyou-GRP-U8-XXE/Oracle-WebLogic-CVE-2020-14883/Oracle-WebLogic-CVE-2020-14882/Apache-Solr-GetAnyFile/F5…
Stars: ✭ 1,004 (+490.59%)
Mutual labels:  poc
Exphub
Exphub[漏洞利用脚本库] 包括Webloigc、Struts2、Tomcat、Nexus、Solr、Jboss、Drupal的漏洞利用脚本,最新添加CVE-2020-14882、CVE-2020-11444、CVE-2020-10204、CVE-2020-10199、CVE-2020-1938、CVE-2020-2551、CVE-2020-2555、CVE-2020-2883、CVE-2019-17558、CVE-2019-6340
Stars: ✭ 3,056 (+1697.65%)
Mutual labels:  poc
Some pocsuite
用于漏洞排查的pocsuite3验证POC代码
Stars: ✭ 239 (+40.59%)
Mutual labels:  poc
foxy-proxy
A Proof of Capacity proxy which supports solo and pool mining upstreams
Stars: ✭ 33 (-80.59%)
Mutual labels:  poc
Cve 2020 0796 Lpe Poc
CVE-2020-0796 Local Privilege Escalation POC
Stars: ✭ 215 (+26.47%)
Mutual labels:  poc
poc-github-actions
Various proofs of concept examples using Github Actions 🤖
Stars: ✭ 103 (-39.41%)
Mutual labels:  poc
Poc Collection
poc-collection 是对 github 上公开的 PoC 进行收集的一个项目。
Stars: ✭ 210 (+23.53%)
Mutual labels:  poc
slui-file-handler-hijack-privilege-escalation
Slui File Handler Hijack UAC Bypass Local Privilege Escalation
Stars: ✭ 81 (-52.35%)
Mutual labels:  fileless
kubeadm-tf
PoC; terraform + kubeadm
Stars: ✭ 25 (-85.29%)
Mutual labels:  poc
PoC-ActiveX
PoC ActiveX SVG Document Execution
Stars: ✭ 21 (-87.65%)
Mutual labels:  poc
graphql-poc
This project is a proof of concept to test graphQL usage in PHP.
Stars: ✭ 22 (-87.06%)
Mutual labels:  poc

Living Off The Land

Fileless attack with persistence

Since antivirus software became increasingly better at detecting malicious files, the obvious solution is to not use any files at all.

It is possible to achieve persistence by solely relying on existing operating system files to do the job. On Windows, there are lots of LOLBins (living off the land binaries), like Powershell. The registry can be used for storage. Technically, the registry is stored on the disk, therefore this is a Type II fileless attack.

Payload.exe: A native executable file, displaying a MessageBox. Goal is to have this executable run at startup (persistence) and never write it to the file system.

In addition, scripts or other files must not be written to the file system either.

Execution and persistence

Execution and persistence need to happen in multiple stages.

Stage 1: Installer

The installer (LivingOffTheLand.exe) is a native executable file. It can be either started normally (double clicking the EXE file), or it can be executed in memory, i.e. by a RCE exploit. Normal execution will likely be detected, while AV evasion is more likely with in-memory execution.

The installer's job:

  • Write Injector.exe to the registry
  • Write this inline powershell script to HKCU...\Run for persistence
  • Run powershell.exe for immediate execution
mshta "javascript:close(new ActiveXObject('WScript.Shell').run('powershell \"[Reflection.Assembly]::Load([Microsoft.Win32.Registry]::CurrentUser.OpenSubKey(\\\"Software\\\\Microsoft\\\\Internet Explorer\\\").GetValue($Null)).EntryPoint.Invoke(0,$Null)\"',0))"

This is a formatted version of the above line:

mshta "
    javascript:close(
        new ActiveXObject('WScript.Shell')
            .run('
                powershell \"
                    [Reflection.Assembly]::Load([Microsoft.Win32.Registry]::CurrentUser
                        .OpenSubKey(\\\"Software\\\\Microsoft\\\\Internet Explorer\\\")
                        .GetValue($Null))
                        .EntryPoint
                        .Invoke(0,$Null)
                \"
            ',0)
    )
"

This startup command is written to the HKCU...\Run key. It may only have 260 characters (MAX_PATH). Powershell.exe loads Injector.exe from the registry and executes it in memory. Injector.exe is required to be written in C#! Because of the MAX_PATH restriction, there is only room to perform a simple Assembly.Load().EntryPoint.Invoke() here.

mshta.exe is not essential. But without it, a powershell window is briefly visible. The JavaScript allows to start powershell with SW_HIDE.

Because mshta is wrapping powershell, which is wrapping C#, multiple layers of string escaping are required :(

To masquerade the registry value, a null embedded character is used. The name of the registry value starts with a NULL character, followed by the actual name. Since WinAPI uses null terminated strings, the name of the value technically equals to NULL. However, the script is still executed on startup because the content of the value is valid. The registry editor is unable to display this value, and so is any program that uses the WinAPI to read the registry. It is required to use the native API, which uses UNICODE_STRING allowing to read and write embedded NULL characters.

It is also required to use RemovalTool.exe to delete this value, or Sysinternals RegDelNull.

Done! Persistence is now achieved. Next, powershell.exe is executed with the above inline script for immediate execution.

Stage 2: Injector

Injector.exe is a C# executable that is stored in a registry value. The powershell inline script loads this executable via Assembly.Load() and invokes its main entry point.

The injector then proceeds to load the actual Payload.exe from its own executable resources. The payload is then injected using the process hollowing technique (RunPE). This injection technique works by creating a process of a legitimate Windows binary (e.g. svchost.exe). The process is created in a suspended state, after which its process memory is unmapped and replaced with the payload file. The thread context is set continue running at the entry point of the payload and then the main thread is resumed.

Stage 3: Payload

As a result, a new process (C:\Windows\System32\svchost.exe) is visible in TaskMgr, but it's actually Payload.exe. This process cannot be distinguished from legitimate instances of the same file without significant effort. Most 32-bit Windows binaries can be used for process hollowing of 32-bit executables.

... and not a single file has been written to the disk today.

Downloads

LivingOffTheLand 1.0.1.zip (ZIP Password: bytecode77)

Project Page

bytecode77.com/living-off-the-land

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].