Forums: Hidden Service Detector (hsd) By Einstein_ - Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Hidden Service Detector (hsd) By Einstein_

#1 User is offline   da_cash 

  • Sergeant
  • Icon
  • Group: Members
  • Posts: 232
  • Joined: 27-January 04

Posted 21 January 2006 - 01:32 PM

Hidden service detector (hsd) will try to get a service list from five different sources: the startard service manager (EnumServicesStatus), from the registry (RegOpenKey and RegSaveKeyA), by calling EnumServicesStatus from a mapped-view of advapi32.dll and finally by reading directly the ServiceDatabase doubly linked list the memory of services.exe. After getting the lists, hsd will compare them and display any hidden services.



EnumServicesStatus is the stadard way to enumerate the services list, and is usually hooked by rootkits. hsd is able to detect when hxdef is hooking this function because at this time the return value no longer comply with what MSDN says.

RegOpenKey is the standard way to read registry keys, and is usually hooked by rootkits. hsd will tell you if the 'SubKeys' returned by RegQueryInfoKey is really the number of sub keys that can be read in HKLM\SYSTEM\CurrentControlSet\Services. Many rootkit does not hook the latest function, so the real number of subkeys is returned by a call to RegQueryInfoKey but less keys can be accessed if a rootkit is hiding some.

RegSaveKeyA is a way to save a key hive to a file. The format of this file is not officialy documented but I included the headers to be able to read it. This function is not often hooked by rootkits but some codes are avaliable to do so (https://www.rootkit.com/newsread.php?newsid=272 see this> and more recently this). For those who are not sure if they must add such code into thier rootkit, do it, you won't loose your time.

hsd will map a copy of advapi32.dll via MapViewOfFile and call EnumServicesStatus from there. No rootkit that I know is actually fixing the images when it is read from the disk to reflect the memory image, and I really want to see it when one will do! This method is used by IceSword to detect hidden services, I actually took the idea from there so thanks to whoever the idea is from. An alternative way to do almost the same thing would be to read the file via ReadFile instead of mapping it, in one piece or byte per byte, and I believe then it would be really hard to fixup.

Walking the ServiceDatabase is not really easy since it is not exported, but with some determination I managed to find a pretty unique byte pattern to locate it. Any service that is running on the system will be referenced in this list - untill a rootkit unlink it. Unlinked services won't be detected by hsd, so this is why you should do this instead of any lame hooking :)


www[at]rootkit[at]com

Attached File(s)

  • Attached File  hsd.rar (32.95K)
    Number of downloads: 361

0

#2 User is offline   naxxatoe 

  • Private First Class
  • Icon
  • Group: Members
  • Posts: 23
  • Joined: 14-January 06

Posted 21 January 2006 - 02:29 PM

I have tested it sucessfully one one of my test systems down here and the only thing i can say is
great


i really like it


another thing i am missing wich would be cool if it would create some log file
would make it easyer to use

but good idea, i like it


Cya
0

#3 User is offline   hidden 

  • Private First Class
  • Icon
  • Group: Members
  • Posts: 108
  • Joined: 29-November 03

Posted 21 January 2006 - 03:14 PM

ok i'm going to test it too so thx to share it with us
0

#4 User is offline   Lukasnix 

  • Private
  • Icon
  • Group: Members
  • Posts: 13
  • Joined: 08-November 05

Posted 22 January 2006 - 12:10 AM

thanks will definitly be handy especially when detecting "unknown" rats :0
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users

  • Share



Our Sponsors:


SwiftLayer Affiliate Web Hosting