####################################################################### Luigi Auriemma Application: Proficy HMI/SCADA - iFIX http://www.ge-ip.com/products/family/proficy_hmiscada_ifix Versions: Historian Data Archiver <= 4.0 SIM7 and 3.5 SIM14 Platforms: Windows Bug: stack overflow Exploitation: remote, versus server Date: probably found 18 Jan 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 ====== ihDataArchiver.exe is a service running on port 14000. The protocol is composed by: - 2 bytes: magic - 0x26 bytes: header - optional 4 bytes: a 32bit containing some options - data The service performs a simple operation for reading that 32bit number: int options; len = header_size - 0x28; if(len) { recv_len = receive_function(&options, len, 0); ... with the effect of causing a classical stack overflow by writing a custom amount of data in the stack 32bit variable. Code execution is possible because we can force an exception before the checking of the canary as demonstrated in my proof-of-concept. ####################################################################### =========== 3) The Code =========== http://aluigi.org/poc/ifix_1.zip ####################################################################### ====== 4) Fix ====== http://www.zerodayinitiative.com/advisories/ZDI-11-320/ #######################################################################