 |
|
 |
Hello.
Can you send me all your staff, that mentioned?
THX.
(Dakujem )
Moj email: xearinox@atlas.sk
|
|
|
|
 |
|
 |
I download the code,but it does not work.
My computer is windows xp with service pack 2.And i follow the instructions on the page,i think the boot code really works,but something goes wrong,because the instruction "u IoCreateDriver" shows different result.Since i just begging to learn debugging,i do not know how to explain all this.Can you give some advice?Or you can mail me:wzf200594@gmail.com will be more appreciated!
thanks very much!
|
|
|
|
 |
|
 |
Hi, it seems that 16bit part of bootkit failed. You can try to add read key instruction under the startNTLDR(or main) label (http://webster.cs.ucr.edu/AoA/DOS/ch13/CH13-3.html#HEADING3-93):
mov ah, 0 ;Read Key opcode
int 16h
If the PC really booted from CD, then it will hang and wait for keypress.
Or you can use debugger to check whether bootcode was copied to RAM:
!dd 9f00h <- this will show you physical memory
dd 8009f000h <- which is mapped to virtual memory (if /3GB boot switch is not on)
u 8009f000h <- should show something similar to code under label boot.asm/residentStart
My guess is that "intHandler" failed. For transition from 16bit to 32bit mode I used method found in eeye bootkit (see references): In intHandler, it expects certain version of NTLDR and it checks this by comparing bytes at address 46b6fh (base is 20000h). If there're different bytes than expected (0f685f08bh), then it does nothing. But if the bytes are as expected, it writes call instruction, which is executed in the 32bit mode and calls stager32. You can open NTLDR in IDA disassambler and check the bytes. If there are different bytes, you must find different code in NTLDR, which runs in 32bit mode and place "call stager32" there. Note the call opcode must be placed on correct instruction boundary.
I appreciate you're trying to figure out with debugger how it works, because this article is about method, not about program for script kiddies Let me now if you achieve some progress
|
|
|
|
 |
|
|
 |
|
 |
Thank you for your help!
I have tried your method,the boot code really works,vmware just stop there waitting for my key stroke.I think you are right.But i still do not know why you hardcode the address?Can you explain that?Besides I have downloaded your source code,but it was really hard to goole the Czech language.If you can recomment the source code ,that would be of great help!Thanks.
|
|
|
|
 |
|
 |
Why the hardcoded address? Well when the PC starts, the CPU runs in 16bit mode (see Intel manual for details). But our code must run also in 32bit mode. So we place instruction on address which we know gets executed after NTLDR switched CPU to 32bit mode. Well guys from Eeye found such address - and I used it in my code (the assumption is that NTLDR is the same on all XP machines, which is unfortunately NOT the case).
But since we now the signature (i.e. what's on the address we're looking for): 0f685f08bh*, we can scan for it. Just start at NTLDR base and scan memory till you find 0f685f08bh. So if you can replace
cmp [ds:si], dword 0f685f08bh
jnz die
with "find address of 0f685f08bh and store it to ds:si", then bootkit should work with you PC too. I'm not asm coder, but I think SCASD instruction should do the job. Hope this helps. About the comments - if you can make this modification, send the sources to me, I'll translate comments and release it as new version here on codeproject.
*this signature may not be long enough, I'd have to look at NTLDR with hex editor too see if there are multiple places with this signature
|
|
|
|
 |
|
 |
Thank you for your help!
I have just tried your method,unfortunately i can not find the 0f685f08bh.I use WinHex to search the signature,but the reversed order 08bf085f6h did exist,up to 74 times.I also search on a another machine with sp3,but neither the orginal one nor the reversed one existed.Can you give me a copy of your ntldr?I wonder why the ntldr shows so different on different machines?
Thank you!
|
|
|
|
 |
|
 |
x86 CPUs are little endian, it means that 0f685f08bh represents byte sequence 8b f0 85 f6. Here's my NTLDR: http://dl.dropbox.com/u/1839193/ntldr[^] You can look at 26b6fh and you'll see the sequence.
But if this sequence is not in SP3, we can forget about it and need to find another sequence of opcodes that gets executed in 32b mode. I guess there are opcodes specific for 32b, but even if we find them, we cannot be sure they get executed. What about some code, which runs (or triggers) just after 16/32b switch?
Maybe Volume 3A: System Programming Guide will help http://www.intel.com/products/processor/manuals/[^]
|
|
|
|
 |
|
 |
Thank you for your help!
I have other question:I suddenly realized that the source code you have written runs under cd,it copy the patch code to the address which will be executed later,does this means that the orginal operation the ntldr might operate would be ignored?The second is that when the system boots up,the ntldr shall call int 15,what does int 15 does?Can you explain this?The third is that how to find the code in ntldr executed under virtual mode?Can we debug the ntldr?
May be the question are silly!But I just do not understand...
Many thanks!
|
|
|
|
 |
|
 |
The original code of NTLDR won't be ignored - in fact we are patching it with just call instruction. So when our code gets called, we execute the exact same instructions as NTLDR would and then we return just after the patch.
This is the original code we have to execute (i.e. the signature bytes):
mov esi, eax
test eax, eax
jnz short @nojz
pushfd
add dword [esp+4], 14h <- adjust stack so EIP will return on correct address in NTLDR
popfd
@nojz:
ret
About function of int 15h please see http://www.ctyme.com/rbrown.htm[^]
Debugging of NTLDR is infeasible, it's better to use IDA and do static analysis. Send me SP3 NTLDR, I'll look at it.
|
|
|
|
 |
|
 |
Thank you for your reply!
I am sorry,can I have your email?I do not have a server to upload my ntldr file.
I am trying to read your code,along with the materials on this page.Below are my first questions:
You said when code in the iso file are executing,the code hook int 15,But i can not find it?What i can understand about the boot.asm up to now is that the code copy itself to the address 9f00:0000 and load the first sector of the disk(which I know is the MBR) to the address 0000:7c00,then give the control the code at 0000:7c00.The mbr detects the partitions on the disk and locates the bootable one.Then the code in the MBR loads the first sector of the bootable partition and give control to it!The first the sector of the bootable partition then detects the NTLDR and give control to it!Am i right?
Many thanks~~
|
|
|
|
 |
|
 |
The hook is done here:
push 0
pop es
mov [es:15h*4], word intHandler
mov [es:15h*4+2], word base
It just replaces handler's address in interrupt table.
Yes, you're correct, very good. The CD code makes itself resident in memory and then boots PC from disk (the same way BIOS would do if you selected option boot from hdd and not from CD).
|
|
|
|
 |
|
 |
Thank you for your reply!Now i know how to hook int 15.
I now also know about
mov [es ], dword base32+stager32 ; [9f000h=jmp main]=&stager32
which functions as when the machine excutes our replaced code,it will begin from stager32 module.
The following questions are in stager32 module:
1)What does
mov edi, [esp+24h] ; use EIP as a ptr into OSLOADER
do?
2)Why 8009f000h?I do not know why you choose this address?
Tnanks~~
|
|
|
|
 |
|
 |
Correct.
1) It's eeye's code. Apparently this routine (stager32) was called, so eip of code where it was executing before the call is stored on the stack. Store eip to edi, then get base from it and start scaning for ntoskrnl. It's shelcoder's black magic. You need to now how PE format looks like to fully understand it. I think you can find more info in reference [3].
Now when I think about it, there's one more condition for address of ntldr patch - it must be executed after the ntoskrnl was mapped to memory.
2) 8009f000h (or physical 9f000h) is address which doesn't get modified during boot process, so we can safely store our code there. Of course there are other addresses, this one is well known and proven.
Did you get my email address? Send me SP3 NTLDR
|
|
|
|
 |
|
 |
Another trouble is when i read the paper
Windows Vista 64bits and unexported kernel symbols
I really get confused the new symbols and the functions.So I want to know if you can give me some hints about the following instructions
mov esi,[edi]
;http://www.msuiche.net/papers/Windows_Vista_64bits_and_unexported_kernel_symbols.pdf
mov esi, [esi] ; points to base of loader table
mov esi, [esi] ; points to first entry it's Ntoskrnl.exe
mov ebp, [esi+24]
; to obtain pointer to ntoskrnls, base address,it 24 bytes from it's entry
mov [ntBase+base32], ebp
Thanks~~
|
|
|
|
 |
|
 |
This is shellcode not really relevant to article, we should be focusing on reliable NTLDR patch address. For details see [3] and PE format specification.
|
|
|
|
 |
|
 |
The idea behind this code is great. And I think the code is self-explanatory. But still I am getting some problem with my NTLDR as at the location 46b6FH, the hex sequence 0f685f08bH is not found(checked for both big and little endian format). I think this is due to the version of NTLDR (XP SP3).
What I understood is, I need a instruction sequence in NTLDR which runs in protected mode and that I have to replace with the call of 32 bit stager.
But I don't know how to find sequences that runs in protected mode as I have no knowledge of the disassembly of NTLDR. Please help me find a replace of 0f685f08bH, so that your code works for my system too.
|
|
|
|
 |
|
 |
It sounds greate,but it does not work for me!Still i appreciate the idea!Can i have your email or msn, i want to get more detailed information to have it work on my computer!thanks
|
|
|
|
 |
|
 |
which version of xp did you use to test this?it is less than sp2 as far as the screenshot shows.i have a xpsp2 image on virtual PC but it does not seem to that the code is working as it should. or maybe it is due to that i couldn't find the "msv1_0!MsvpPasswordValidate" routine in msv1_0.dll in my xpsp2 installation.
|
|
|
|
 |
|
 |
Hi, it's tested on sp1 and sp2, don't care about the screenshot. As stated in article, msv1_0!MsvpPasswordValidate is not exported, may this be the reason why you could not find it?
Certainly there are some problems with BIOS' not accepting boot CD created with CDIMAGE. Don't know where's the problem… feel free to find out and fix it
|
|
|
|
 |
|
 |
Hey, I got locked out of my computer several days ago. I tried bootkit several times and still couldn't log on to my admin account. Finally I made it work with the Reset Windows Password 1.3 - http://www.top-password.com/reset-windows-password.html. The good news is that it works. The bad news is it is not free.
|
|
|
|
 |
|
 |
i tried to burn your iso to a cd , but it didn't work as expected . anything more i shoud care for?please help
|
|
|
|
 |
|
 |
After burning the ISO, did you get normal CD with just readme on it? What's your OS? Is booting from CD allowed on your machine?
There are some options how to debug it - add beep (using PC speaker - port 61h) to boot.asm to make sure PC booted from CD. The problem might be I commented out signature bytes (db 55h, 0aah) since VMWare BIOS didn't require it and your BIOS doesn't want to boot code without signature bytes.
Once you're sure the PC booted from CD, you can connect kernel debugger to the PC using serial port or firewire and follow debugging procedure described in this article.
|
|
|
|
 |
|
 |
yes i got normal cd with just a readme file on it,the cd's size is 50k,so small.and i allowed my machine to boot from cd(for this i tried it on different machines)
i don't know much about debug, if problems come from that i would like to learn how to connect kernel debugger,the worst thing is when you boot form the cd nothing special happened ,i really have no
idea about that,anyway thanks for your answer
|
|
|
|
 |
|
 |
Actually, nothing special should happen, except you can log on without password Currently I'm on vacation but I'll prepare more interactive version of ISO with some diagnostics when I get to my PC.
|
|
|
|
 |