This file is indexed.

/usr/lib/python2.7/dist-packages/rekall/plugins/overlays/windows/undocumented.py is in python-rekall-core 1.6.0+dfsg-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# Rekall Memory Forensics
# Copyright (C) 2007,2008 Volatile Systems
# Copyright (C) 2010,2011,2012 Michael Hale Ligh <michael.ligh@mnin.org>
# Copyright 2013 Google Inc. All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#

"""This file contains all the undocumented structs that were derived by
reversing. We try to also include references to the original reverser.

"""

AMD64 = {
    # Reference:
    # http://gate.upm.ro/os/LABs/Windows_OS_Internals_Curriculum_Resource_Kit-ACADEMIC/WindowsResearchKernel-WRK/WRK-v1.2/base/ntos/mm/wrtfault.c

    # From http://www.cnblogs.com/kkindof/articles/2571227.html
    # Reversed from MiSessionInsertImage

    # win8.1.raw 18:05:45> dis "nt!MiSessionInsertImage"
    # 0xf802d314344a   4E e871030300           CALL 0xf802d31737c0   nt!memset
    # ...
    # 0xf802d314345a   5E 48897b20             MOV [RBX+0x20], RDI

    # typedef struct _IMAGE_ENTRY_IN_SESSION {
    #     LIST_ENTRY Link;
    #     PVOID Address;
    #     PVOID LastAddress;
    #     ULONG ImageCountInThisSession;
    #     LOGICAL ImageLoading;
    #     PMMPTE PrototypePtes;
    #     PKLDR_DATA_TABLE_ENTRY DataTableEntry;
    #     PSESSION_GLOBAL_SUBSECTION_INFO GlobalSubs;
    # } IMAGE_ENTRY_IN_SESSION, * PIMAGE_ENTRY_IN_SESSION;
    '_IMAGE_ENTRY_IN_SESSION': [None, {
        'Link': [0, ['_LIST_ENTRY']],
        'Address': [0x10, ['Pointer']],
        'LastAddress': [0x18, ['Pointer']],
    }],

    # Reversed from tcpip.sys!TcpStartPartitionModule
    "PARTITION_TABLE": [None, {
        "Partitions": [8, ["Array", dict(
            target="Pointer",

            count=lambda x: x.obj_profile.get_constant_object(
                "PartitionCount", "unsigned int"),

            target_args=dict(
                target="Array",
                target_args=dict(
                    count=4,
                    target="FIRST_LEVEL_DIR"
                    )
                )
            )]],
        }],

    # ntoskrnl.exe!RtlCreateHashTable (PoolTag:HTab)
    "FIRST_LEVEL_DIR": [0x24, {
        "SizeOfSecondLevel": [0x8, ["unsigned int"]],

        "Mask": [0x10, ["unsigned int"]],

        # Reversed from ntoskrnl.exe!RtlpAllocateSecondLevelDir
        "SecondLevel": [0x20, ["Pointer", dict(
            target="Array",
            # Actual hash table (PoolTag:HTab)
            target_args=dict(
                count=lambda x: x.SizeOfSecondLevel,
                target="_LIST_ENTRY"
                )
            )]],
        }],

    '_SERVICE_DESCRIPTOR_TABLE' : [0x40, {
        'Descriptors' : [0x0, ['Array', dict(
            target='_SERVICE_DESCRIPTOR_ENTRY',
            count=2
            )]],
        }],

    # In 64 bit the KiServiceTable is a list of RVAs based off the table base to
    # the destination pointers.
    # Ref:
    # http://forum.sysinternals.com/keservicedescriptortableshadow-address_topic14093.html
    '_SERVICE_DESCRIPTOR_ENTRY' : [0x20, {
        'KiServiceTable' : [0x0, ['Pointer', dict(
            target="Array",
            target_args=dict(
                count=lambda x: x.ServiceLimit,
                target="int",
                )
            )]],
        'CounterBaseTable' : [0x8, ['Pointer']],
        'ServiceLimit' : [0x10, ['unsigned long long']],
        'ArgumentTable' : [0x18, ['Pointer']],
        }],

    # Documented in ./base/ntos/inc/mm.h WRK-v1.2.
    "_UNLOADED_DRIVER": [0x28, {
        "Name": [0, ["_UNICODE_STRING"]],
        "StartAddress": [0x10, ["Pointer"]],
        "EndAddress": [0x18, ["Pointer"]],
        "CurrentTime": [0x20, ["WinFileTime"]],
        }],
}


I386 = {
    '_IMAGE_ENTRY_IN_SESSION': [None, {
        'Link': [0x00, ['_LIST_ENTRY']],
        'Address': [0x08, ['pointer', ['address']]],
        'LastAddress': [0x0b, ['pointer', ['address']]],
    }],

    # Reversed from tcpip.sys!TcpStartPartitionModule
    "PARTITION_TABLE": [None, {
        "Partitions": [4, ["Array", dict(
            target="Pointer",

            count=lambda x: x.obj_profile.get_constant_object(
                "PartitionCount", "unsigned int"),

            target_args=dict(
                target="Array",
                target_args=dict(
                    count=4,
                    target="FIRST_LEVEL_DIR"
                    )
                )
            )]],
        }],

    # ntoskrnl.exe!RtlCreateHashTable
    "FIRST_LEVEL_DIR": [0x24, {
        "SizeOfSecondLevel": [0x8, ["unsigned int"]],

        "Mask": [0x10, ["unsigned int"]],

        # Reversed from ntoskrnl.exe!RtlpAllocateSecondLevelDir
        "SecondLevel": [0x20, ["Pointer", dict(
            target="Array",
            target_args=dict(
                count=lambda x: x.SizeOfSecondLevel,
                target="_LIST_ENTRY"
                )
            )]],
        }],

    '_SERVICE_DESCRIPTOR_TABLE' : [0x20, {
        'Descriptors' : [0x0, ['Array', dict(
            target='_SERVICE_DESCRIPTOR_ENTRY',
            count=2
            )]],
        }],

    '_SERVICE_DESCRIPTOR_ENTRY' : [0x10, {
        'KiServiceTable' : [0x0, ['Pointer', dict(
            target="Array",
            target_args=dict(
                count=lambda x: x.ServiceLimit,
                target="unsigned int",
                )
            )]],
        'CounterBaseTable' : [0x4, ['Pointer']],
        'ServiceLimit' : [0x8, ['unsigned long']],
        'ArgumentTable' : [0xc, ['Pointer']],
        }],

    # Documented in ./base/ntos/inc/mm.h WRK-v1.2.
    "_UNLOADED_DRIVER": [24, {
        "Name": [0, ["_UNICODE_STRING"]],
        "StartAddress": [8, ["Pointer"]],
        "EndAddress": [12, ["Pointer"]],
        "CurrentTime": [16, ["WinFileTime"]],
        }],
}

# TODO: Move to their own profile.
# These come from the reactos ndk project.
ENUMS = {
    "_KOBJECTS": {
        "0": "EventNotificationObject",
        "1": "EventSynchronizationObject",
        "2": "MutantObject",
        "3": "ProcessObject",
        "4": "QueueObject",
        "5": "SemaphoreObject",
        "6": "ThreadObject",
        "7": "GateObject",
        "8": "TimerNotificationObject",
        "9": "TimerSynchronizationObject",
        "10": "Spare2Object",
        "11": "Spare3Object",
        "12": "Spare4Object",
        "13": "Spare5Object",
        "14": "Spare6Object",
        "15": "Spare7Object",
        "16": "Spare8Object",
        "17": "Spare9Object",
        "18": "ApcObject",
        "19": "DpcObject",
        "20": "DeviceQueueObject",
        "21": "EventPairObject",
        "22": "InterruptObject",
        "23": "ProfileObject",
        "24": "ThreadedDpcObject",
        "25": "MaximumKernelObject"
    },
}