The OpenNET Project
 
Search (keywords):  SOFT ARTICLES TIPS & TRICKS SECURITY
LINKS NEWS MAN DOCUMENTATION


Followup: breakpoint the stack buffer overflow from executing maliciouscode like SQL Slammer worm


<< Previous INDEX Search src Set bookmark Go to bookmark Next >>
Date: Tue, 11 Feb 2003 08:57:42 -0500
From: Peter Huang <yinrong@rogers.com>
To: bugtraq@securityfocus.com
Subject: Followup: breakpoint the stack buffer overflow from executing maliciouscode like SQL Slammer worm

Andrew McGill emailed me with the following comments:

> This is a nice technique - however it is quite probable that a
> jmp esp instruction can be found which is preceeded by an
> innocuous instruction ( add bx,si ; jmp esp ... ) ... "quite
> probable" in the above means I haven't actually looked.

That was a very good question. Actually, I thought about the above more
after my original post and came up with the following. The basic concept is
⌠there will be no void parameter function call or traditional WINAPI call■.
For a void parameter function:

1.      Call SomeVoidFunction()
The compiler will generate this code such as:

	Push      0
	Call SomeVoidFunction
	Add  esp, 4        ; can be pop ecx etc.

In the called function SomeVoidFunction itself, it is coded as:

	Add  [esp+4], 0cch
	ret

2.      Call SomeApiFunction(par1, par2 .. )
The compiler will generate this code such as:

	Push 0
	Push ..
	Push par2
	Push par1
	Call SomeApiFunction	; PASCAL-style
	Add  esp, 4        ; can be pop ecx, etc

In the called function SomeApiFunction itself, it is coded as:

	Mov  [esp+4+X << 2], 0cch    ; where x is the parameter number
	Ret  X << 2

3.	For a normal C function with parameter, it is still coded as:
	add	[esp+4], 0cch
	ret

This method will work to call old existing libraries because it just wastes
a few cycles with ⌠push 0■ and ⌠add esp, 4■.
However, the 0CCh-inserted libraries or object files will not work with old
call methods (without extra push 0 and pop).

Best regards

Peter Huang
For the latest update on this thread, pls visit
http://members.rogers.com/yinrong/articles/BreakpointBufferFlow.htm



<< Previous INDEX Search src Set bookmark Go to bookmark Next >>

ПОДПИШИСЬ НА ЖУРНАЛ Linux Format 2012!

Журнал "Linux Format" (Линукс Формат)- Единственный в России и странах СНГ журнал на русском языке, посвящённый Linux и свободному ПО. Журнал для IT-директоров, IT-менеджеров, программистов, системных администраторов, учителей школ и преподавателей ВУЗов и всех пользователей ПК. В каждом выпуске: Новости индустрии OpenSource, обзоры новинок свободного ПО, обучающие и методические статьи.

Каждый, кто оформит подписку, получает бонусы и подарки- объёмные наклейки на системный блок, диск с архивом номеров за 2005-2011 г.г. и ежемесячно электронную версию журнала в pdf-формате.

Оформить подписку на год


  Закладки на сайте
  Проследить за страницей
Created 1996-2012 by Maxim Chirkov  
ДобавитьРекламаВебмастеруГИД  
RUNNet TopList