ALERT: Buffer overflow di libc su Solaris [ID: A-99012A]
-----BEGIN PGP SIGNED MESSAGE-----
GARR-CERT Security Alert
- ------------------------------------------------------------------------------
Alert ID: A-99012A
Data di creazione: Mon May 24 11:16:51 1999
Titolo: Buffer overflow di libc su Solaris
Gravita': alta
- ------------------------------------------------------------------------------
1) Descrizione del problema
E' possibile sovrascrivere dei buffer di memoria quando la libreria libc
utilizza la variabile di ambiente LC_MESSAGES: impostando tale variabile in modo
appropriato un utente locale puo' indurre delle applicazioni con il bit SUID
settato (che non siano necessariamente affette da problemi di buffer overflow)
ad eseguire comandi arbitrari.
2) Piattaforme interessate
Accertate: Solaris 2.6 e 2.7 su Sparc.
3) Impatto
Utenti locali possono acquisire privilegi di root.
4) Soluzioni
Non esiste al momento una patch ufficiale dalla Sun. Nell' attesa, dato che non
e' proponibile rimuovere il bit SUID da tutti i programmi che lo hanno settato,
si dovrebbe considerare l'ipotesi di installare un SUID-wrapper, cioe' un
programma che viene eseguito prima dell'originale e che controlli le dimensioni
delle variabili di ambiente.
Di seguito viene riportato il codice sorgente e le istruzioni di un SUID-wrapper
"di emergenza".
- --- Inizio messaggio riportato ---
Make a directory, /subin, and move all setuid root binaries into it.
Remove the setuid bits. Compile the following c program and put it
in place of the old setuid root binaries, with the setuid bit set.
I spent a small amount of time on this, so it itself may be exploitable.
Use with caution.
- --- cut here ---
#include
#define MAX_ENV 255
#define HOLDING_PEN "/subin/"
#define BSIZE 1024
/*
quick and dirty wrapper to defeat overflowing of libraries with
environment variables
5/99, Craig Johnston, caj@lfn.org
this comes with no guarantees except "it seems to work here."
When is security going to become a priority at Sun?
*/
int main(int argc, char **argv, char **envp)
{
char *p, *q, buf[BSIZE];
int i;
while (*envp) { /* whack off long env variables */
for (p = *envp, i = 0; *p ; ++p, ++i)
if (i >= MAX_ENV) {
*p = ' ';
break;
}
++envp;
}
for (p = q = argv[0]; *p; ++p) /* get basename */
if (*p == '/')
q = p + 1;
snprintf(buf, BSIZE, "%s%s", HOLDING_PEN, q);
execve(buf, argv, envp);
printf("exec() failed, bailing!
");
exit(1);
}
- --- cut here ---
- --- Fine messaggio riportato ---
5) Riferimenti
Nessuno.
Appendice
GARR-CERT Home Page
http://security.fi.infn.it/GARR-CERT (temporaneamente)
- ------------------------------------------------------------------------------
- ------------------------------------------------------------------------------
Paolo Amendola Phone. +39 80 5443194
GARR-CERT / I.N.F.N. Sezione di Bari Fax. +39 80 5442470
Bari, Italy email. paolo.amendola@ba.infn.it
PGP key: http://security.fi.infn.it/cgi-bin/spgpk.pl
- ------------------------------------------------------------------------------
-----BEGIN PGP SIGNATURE-----
Version: 2.6.3ia
Charset: noconv
iQCVAwUBN0kZUCkc7/YS2hptAQEDRAP/fZtx5uulNxRftk5HdJpPf0zPvUZ+jX5h
GpedNf6qRc0msCjr81XphSj3SgWTok3oXqSe5jniOjUKepFh1a3GrBo6JCUc8nHs
OPclPpT2qCxKbbEXt6F4X/QjtI5k018ig3X9JBMaj9bye9mkEiyxD+WGMQH/rSCI
GrN1yh9Vkc8=
=bkmF
-----END PGP SIGNATURE-----
GARR-CERT Security Alert
- ------------------------------------------------------------------------------
Alert ID: A-99012A
Data di creazione: Mon May 24 11:16:51 1999
Titolo: Buffer overflow di libc su Solaris
Gravita': alta
- ------------------------------------------------------------------------------
1) Descrizione del problema
E' possibile sovrascrivere dei buffer di memoria quando la libreria libc
utilizza la variabile di ambiente LC_MESSAGES: impostando tale variabile in modo
appropriato un utente locale puo' indurre delle applicazioni con il bit SUID
settato (che non siano necessariamente affette da problemi di buffer overflow)
ad eseguire comandi arbitrari.
2) Piattaforme interessate
Accertate: Solaris 2.6 e 2.7 su Sparc.
3) Impatto
Utenti locali possono acquisire privilegi di root.
4) Soluzioni
Non esiste al momento una patch ufficiale dalla Sun. Nell' attesa, dato che non
e' proponibile rimuovere il bit SUID da tutti i programmi che lo hanno settato,
si dovrebbe considerare l'ipotesi di installare un SUID-wrapper, cioe' un
programma che viene eseguito prima dell'originale e che controlli le dimensioni
delle variabili di ambiente.
Di seguito viene riportato il codice sorgente e le istruzioni di un SUID-wrapper
"di emergenza".
- --- Inizio messaggio riportato ---
Make a directory, /subin, and move all setuid root binaries into it.
Remove the setuid bits. Compile the following c program and put it
in place of the old setuid root binaries, with the setuid bit set.
I spent a small amount of time on this, so it itself may be exploitable.
Use with caution.
- --- cut here ---
#include
#define MAX_ENV 255
#define HOLDING_PEN "/subin/"
#define BSIZE 1024
/*
quick and dirty wrapper to defeat overflowing of libraries with
environment variables
5/99, Craig Johnston, caj@lfn.org
this comes with no guarantees except "it seems to work here."
When is security going to become a priority at Sun?
*/
int main(int argc, char **argv, char **envp)
{
char *p, *q, buf[BSIZE];
int i;
while (*envp) { /* whack off long env variables */
for (p = *envp, i = 0; *p ; ++p, ++i)
if (i >= MAX_ENV) {
*p = ' ';
break;
}
++envp;
}
for (p = q = argv[0]; *p; ++p) /* get basename */
if (*p == '/')
q = p + 1;
snprintf(buf, BSIZE, "%s%s", HOLDING_PEN, q);
execve(buf, argv, envp);
printf("exec() failed, bailing!
");
exit(1);
}
- --- cut here ---
- --- Fine messaggio riportato ---
5) Riferimenti
Nessuno.
Appendice
GARR-CERT Home Page
http://security.fi.infn.it/GARR-CERT (temporaneamente)
- ------------------------------------------------------------------------------
- ------------------------------------------------------------------------------
Paolo Amendola Phone. +39 80 5443194
GARR-CERT / I.N.F.N. Sezione di Bari Fax. +39 80 5442470
Bari, Italy email. paolo.amendola@ba.infn.it
PGP key: http://security.fi.infn.it/cgi-bin/spgpk.pl
- ------------------------------------------------------------------------------
-----BEGIN PGP SIGNATURE-----
Version: 2.6.3ia
Charset: noconv
iQCVAwUBN0kZUCkc7/YS2hptAQEDRAP/fZtx5uulNxRftk5HdJpPf0zPvUZ+jX5h
GpedNf6qRc0msCjr81XphSj3SgWTok3oXqSe5jniOjUKepFh1a3GrBo6JCUc8nHs
OPclPpT2qCxKbbEXt6F4X/QjtI5k018ig3X9JBMaj9bye9mkEiyxD+WGMQH/rSCI
GrN1yh9Vkc8=
=bkmF
-----END PGP SIGNATURE-----