[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

RE: mount



Ola Leandro,

Faz o seguinte. Pra quebra seu galho eu fiz um micro programinha que chama o mount como root!

O codigo esta logo abaixo:

 

#include <stdio.h>

#define PATH "/bin/mount"

int main(int argc, char *argv[]){

int uid, gid;

char exec[1024]="\0";

if (argc != 4 ){

printf("\nUso.: %s //maquina/compartilahmento /ponto/de/montagem usuario\n\n",argv[0]);

exit(1);

}

strcpy(exec,PATH);

strcat(exec," -t smbfs ");

strcat(exec,argv[1]);

strcat(exec," ");

strcat(exec,argv[2]);

strcat(exec," -o username=");

strcat(exec,argv[3]);

if (strlen(exec) > sizeof(exec)){

fprintf(stderr,"\nA lista de argumentos eh muito grande!\n\n");

exit(1);

}

 

uid=getuid();

gid=getgid();

setuid(0);

setgid(0);

system(exec);

setuid(uid);

setgid(gid);

return(0);

}

 

Copie esse codigo em um arquivo chamado mymnt.c depois execute o seguinte comando:

gcc -o /bin/mymnt mymnt.c

depois como root:

chmod +x /bin/mymnt

chmod +s /bin/mymnt

Entao sera gerado o arquivo /bin/mymnt

Para utiliza-lo eu vou te dar um exemplo:

Debian:~# /bin/mymnt

Uso.: /mymnt //maquina/compartilahmento /ponto/de/montagem usuario

Debian:~# /mymnt //hadrion/w /mnt/barns/ root

Password: xxxxxxxxx

Debian:~# ls -la /mnt/barns

total 140930

0 drwxrwxr-x 1 root root 512 Mar 18 09:30 .

0 drwxr-xr-x 7 root root 138 Jan 14 13:17 ..

121 -rwxrwxr-x 1 root root 123511 Nov 13 18:51 005-174525

1408 -rwxrwxr-x 1 root root 1441792 Feb 1 11:10 ADISCF.gnt

136 -rwxrwxr-x 1 root root 139264 Oct 20 14:49 CPGRELAT.dll

1212 -rwxrwxr-x 1 root root 1241088 Oct 20 15:35 CTCRELAT.dll

252 -rwxrwxr-x 1 root root 258048 Oct 20 14:52 CrcRelat.dll

5 -rwxrwxr-x 1 root root 4845 Oct 18 09:35 IMBBEM.CBL

....

..

.

Debian:~# id

uid=505(armando) gid=505(armando) groups=505(armando),508(oracle9i)

 

 

Acho que da pra quebrar seu galho!!!

ps.: Cuidado com esse programa. Ele usa usa o ID do root pra executar o comando. Esse programa pode ter varios problemas de segurança! Então utilize-o apenas provisoriamente, ate vc nao encontrar uma solução melhor!

t+

[ ]'s











Use Your Hadrion WebMail too!
Access: http://www.hadrion.com.br
Doubts? wendel@hadrion.com.br

________________________________________________
This mail was sent by Hadrion WebMail 1.0

Reply to: