####################################################################### Luigi Auriemma Application: HP OpenView Performance Agent http://www8.hp.com/us/en/software/software-product.html?compURI=tcm:245-937022 Versions: coda.exe <= 10.50.190 Platforms: Windows, Linux, Solaris, HP-UX, AIX Bug: stack overflow Exploitation: remote, versus server Date: probably found 01 Jun 2011 Author: Luigi Auriemma e-mail: aluigi@autistici.org web: aluigi.org ####################################################################### 1) Introduction 2) Bug 3) The Code 4) Fix ####################################################################### =============== 1) Introduction =============== ??? ####################################################################### ====== 2) Bug ====== ovbbccb.exe is a SYSTEM service running on port 383 and coda.exe is the service that handles all the HTTP requests for /Hewlett-Packard/OpenView/Coda/ The function that reads some strings from the CODA protocol uses a temporary stack buffer of 1024 bytes where is copied the data of the client trusting a 16bit value that acts as size: 0043BE30 /$ 81EC 10040000 SUB ESP,410 0043BE36 |. A1 E4664900 MOV EAX,DWORD PTR DS:[4966E4] 0043BE3B |. 33C4 XOR EAX,ESP 0043BE3D |. 898424 0C040000 MOV DWORD PTR SS:[ESP+40C],EAX 0043BE44 |. 8B8424 14040000 MOV EAX,DWORD PTR SS:[ESP+414] 0043BE4B |. 56 PUSH ESI 0043BE4C |. 57 PUSH EDI 0043BE4D |. 8BF9 MOV EDI,ECX 0043BE4F |. 8D4C24 08 LEA ECX,DWORD PTR SS:[ESP+8] 0043BE53 |. 51 PUSH ECX 0043BE54 |. 8BCF MOV ECX,EDI 0043BE56 |. 894424 10 MOV DWORD PTR SS:[ESP+10],EAX 0043BE5A |. 8D7424 14 LEA ESI,DWORD PTR SS:[ESP+14] 0043BE5E |. E8 4DFDFFFF CALL coda.0043BBB0 ; get the 16bit size 0043BE63 |. 0FB74424 08 MOVZX EAX,WORD PTR SS:[ESP+8] 0043BE68 |. 85C0 TEST EAX,EAX 0043BE6A |. 76 24 JBE SHORT coda.0043BE90 0043BE6C |. 53 PUSH EBX 0043BE6D |. 55 PUSH EBP 0043BE6E |. 8B2D 48544700 MOV EBP,DWORD PTR DS:[<&OvXpl.?ReadUInt8>; OvXpl.?ReadUInt8@DataInputStream_t@OvXplIo@@QBEEXZ 0043BE74 |. 8D9F B4090000 LEA EBX,DWORD PTR DS:[EDI+9B4] 0043BE7A |. 8BF8 MOV EDI,EAX 0043BE7C |. 8D6424 00 LEA ESP,DWORD PTR SS:[ESP] 0043BE80 |> 8BCB /MOV ECX,EBX ; copy 0043BE82 |. FFD5 |CALL EBP 0043BE84 |. 8806 |MOV BYTE PTR DS:[ESI],AL 0043BE86 |. 83C6 01 |ADD ESI,1 0043BE89 |. 83EF 01 |SUB EDI,1 0043BE8C |.^75 F2 \JNZ SHORT coda.0043BE80 This function is called only in 3 points, one of which is through the 0x8c packet. ####################################################################### =========== 3) The Code =========== http://aluigi.org/poc/coda_2.dat nc SERVER 383 < coda_2.dat ####################################################################### ====== 4) Fix ====== http://www.zerodayinitiative.com/advisories/ZDI-12-115/ #######################################################################