📚 OpenRCE is preserved as a read-only archive. Launched at RECon Montreal in 2005. Registration and posting are disabled.








Flag: Tornado! Hurricane!

 Forums >>  Brainstorms - General  >>  More on VADs

Topic created on: May 24, 2008 00:36 CDT by FILEOBJECT .

Ok, so after long effort and lots of typedefs im able to recursively walk the VAD tree without problems.  When i walk the vad tree i get the VPN addresses for each node in the tree such as follows:

Virtual Address. 00100000, Phys Addr: 00000000
MMVAD NODE RANGE: 00000010 - 00000033
  - Parent Link: 00000000
  - Control Area: 81bc8288

The virtual address start in this case is the low MMVAD node range << 16 to give 0x00100000 as a starting address.  When i use MmGetPhysicalAddress on that address however, i am returned a NULL value in the PHYSICAL_ADDRESS structures low part.  This shouldn't be i would think.

Additionally to test if the process had that address mapped, i loaded up kd and monitored the driver, setting the process context to the context of the process in question.  I then attempted to run a "dt int virtualAddr" command to see if i could access something from that VAD space, but kd gives me Memory read errors.  

I guess my question is, am I missing a step somewhere.  I walked the VAD tree using the !VAD command in kd to verify that im getting the right vad values, so this is all rather confusing.

To put what im trying to do into context, the end goal of what im doing is to extract the full VAD virtual address space per vad node and write them to disk.

Any help is appreciated.

~Thanks

  FILEOBJECT     May 25, 2008 22:39.11 CDT
I was wrong about the shifting, it was 12bits to shift left (aka size of a page).  That was what was causing the problems i was having, however now i have a new problem.

There is this VAD that starts at 0x400000 and appears to have 1 page worth of data.  Now i can read from all other vads virtual ranges using the "dc" command, except for this one.  

Information about the VAD below:

kd> !vad 81b17f40 1

VAD @ 81b17f40
  Start VPN           40  End VPN       40  Control Area  81982648
  FirstProtoPte e185e9d8  LastPte e185e9d8  Commit Charge        0 (0.)
  Secured.Flink        0  Blink          0  Banked/Extend        0
  File Offset          0  
      ViewUnmap READWRITE


ControlArea  @ 81982648
  Segment      e185e998  Flink      00000000  Blink        00000000
  Section Ref         0  Pfn Ref           0  Mapped Views        2
  User Ref            2  WaitForDel        0  Flush Count         0
  File Object  00000000  ModWriteCount     0  System Views        0

  Flags (1002000) Commit HadUserReference


Segment @ e185e998
  ControlArea     81982648  ExtendInfo    00000000
  Total Ptes             1
  WriteUserRef           0  SizeOfSegment     1000
  Committed              1  PTE Template        80
  Based Addr             0  Image Base           0
  CreatingProcess 81bcc9c8  FirstMappedVa    40000
  ProtoPtes       e185e9d8


Subsection 1 @ 81982678
  ControlArea  81982648  Starting Sector        0  Number Of Sectors    0
  Base Pte     e185e9d8  Ptes In Subsect        1  Unused Ptes          0
  Flags              40  Sector Offset          0  Protection           4

// trying to read from the vad
kd> dc 0x40000
00040000  ???????? ????????

It should be noted that its only for this 1 vad that im having any trouble reading from.

~thanks

  FILEOBJECT     May 26, 2008 12:54.08 CDT
It seems it most likely is just a COW (copy on write) allocation.

  spender     May 27, 2008 07:35.58 CDT
check page protections with !pte <addr>

  fuzenop     May 31, 2008 15:53.46 CDT
Ok, simple question first, in Windbg are you in the context of the process that owns 0x40000? You must be in the context of the owning process. All previous lookups you did worked because they were kernel addresses. If the answer is no, use ".process ADDR" where addr is the EPROCESS block address of the process whose address space you are trying to read.

  FILEOBJECT     June 3, 2008 00:40.01 CDT
Yup, i was in the context of the system process, of which the VAD node appears in the system processes vadroot.  The problem was actually a calculation error in which a read size was set to 0  which gave the impression that it was failing when it really wasn't failing at all (doh).  

As for why it wasn't showing up in windbg, its not there on a fresh boot, but if i try to read from it becomes available, which sounds like COW.

So yah, problems pretty much solved.

Note: Registration is required to post to the forums.

There are 31,328 total registered users.


Recently Created Topics
[help] Unpacking VMP...
Mar/12
Reverse Engineering ...
Jul/06
let 'IDAPython' impo...
Sep/24
set 'IDAPython' as t...
Sep/24
GuessType return une...
Sep/20
About retrieving the...
Sep/07
How to find specific...
Aug/15
How to get data depe...
Jul/07
Identify RVA data in...
May/06
Question about memor...
Dec/12


Recent Forum Posts
Finding the procedur...
rolEYder
Question about debbu...
rolEYder
Identify RVA data in...
sohlow
let 'IDAPython' impo...
sohlow
How to find specific...
hackgreti
Problem with ollydbg
sh3dow
How can I write olly...
sh3dow
New LoadMAP plugin v...
mefisto...
Intel pin in loaded ...
djnemo
OOP_RE tool available?
Bl4ckm4n


Recent Blog Entries
halsten
Mar/14
Breaking IonCUBE VM

oleavr
Oct/24
Anatomy of a code tracer

hasherezade
Sep/24
IAT Patcher - new tool for ...

oleavr
Aug/27
CryptoShark: code tracer ba...

oleavr
Jun/25
Build a debugger in 5 minutes

More ...


Recent Blog Comments
nieo on:
Mar/22
IAT Patcher - new tool for ...

djnemo on:
Nov/17
Kernel debugger vs user mod...

acel on:
Nov/14
Kernel debugger vs user mod...

pedram on:
Dec/21
frida.github.io: scriptable...

capadleman on:
Jun/19
Using NtCreateThreadEx for ...

More ...


Imagery
SoySauce Blueprint
Jun 6, 2008

[+] expand

View Gallery (11) / Submit