DFIR-ORC / dfir-orc

Forensics artefact collection tool for systems running Microsoft Windows
https://dfir-orc.github.io
GNU Lesser General Public License v2.1
370 stars 42 forks source link

Configuring Locations: the {UserProfiles} variable does not support leading/trailing path #58

Closed ROBERTPASCAL closed 2 years ago

ROBERTPASCAL commented 2 years ago

Dans le cadre de l'extraction du RDP Bitmap Cache, j'ai essayé d'utiliser la variable {UserProfiles} dans la configuration suivante :

<?xml version="1.0"?>
<getthis nolimits="" reportall="">
    <location>%systemdrive%\users\{UserProfiles}\AppData\Local\Microsoft\Terminal Server Client\Cache\</location>
    <location>%systemdrive%\Documents and Settings\{UserProfiles}\Local Settings\Application Data\Microsoft\Terminal Server Client\Cache\</location>
    <samples>
        <sample>
            <ntfs_find name_match="*"/>
        </sample>
    </samples>
</getthis>

J'obtient l'erreur suivante lors de l'execution (RdpBitmapCache.log) :

GetThis v10.0.23
Sample collection
ERROR (Unspecified error, hr=E_FAIL 0x80004005): Could not determine reader for C:\users\{UserProfiles}\AppData\Local\Microsoft\Terminal Server Client\Cache\
ERROR (Unspecified error, hr=E_FAIL 0x80004005): Could not determine reader for C:\Documents and Settings\{UserProfiles}\Local Settings\Application Data\Microsoft\Terminal Server Client\Cache\
ERROR (Unspecified error, hr=E_FAIL 0x80004005): Syntax error in specific locations parsing in config file

Si je modifie {UserProfiles} par le nom du compte utilisateur, l'execution se déroule parfaitement.

La documentation mentionne les éléments suivants :

Configuring Locations
A location is an access path to a specific NTFS volume. Typically, an access path can be:
...
    an environment variable or a dynamic variable, such as
            %SYSTEMDRIVE%
            {UserProfiles}

Avec l'exemple suivant :

<location>{UserProfiles}\Downloads</location>

Pourriez-vous me dire si cette variable fonctionne correctement ou si je fait une errreur de syntaxe ?

fabienfl-orc commented 2 years ago

Hello,

There is a mistake in your configuration but also a bug.

The configuration must never specify '{UserProfile}' prepended with a path.

The '{UserProfile}' element should be replaced during execution with something like :

C:\Windows\system32\config\systemprofile\Downloads
C:\Windows\ServiceProfiles\LocalService\Downloads
C:\Windows\ServiceProfiles\NetworkService\Downloads
C:\Users\Foo\Downloads
C:\Users\Bar\Downloads
...

However it will not work before the 10.0.24 because there is a bug on the path '\Downloads' appended to '{UserProfile}'. Meanwhile you can still use <location>{UserProfiles}</location> and restrict match with ntfs_find's path_match.

Thank you


Bonjour,

Il y a une erreur dans votre configuration mais aussi un bug.

La configuration ne devrait jamais spécifier '{UserProfiles}' précédé d'un chemin.

L'élément '{UserProfile}\Downloads' devrait être remplacé à l'exécution avec par exemple :

C:\Windows\system32\config\systemprofile\Downloads
C:\Windows\ServiceProfiles\LocalService\Downloads
C:\Windows\ServiceProfiles\NetworkService\Downloads
C:\Users\Foo\Downloads
C:\Users\Bar\Downloads
...

Cependant cela ne fonctionnera pas avant la 10.0.24 car il y a un bug sur la gestion d'un chemin '\Downloads' qui suit '{UserProfile}'. En attendant vous pourriez utiliser <location>{UserProfiles}</location> et limiter la recherche avec path_match de ntfs_find.

Merci

fabienfl-orc commented 2 years ago

Also beware that known folders path like %USERPROFILE%\Downloads can be customized out of %USERPROFILE% tree.


Gardez à l'esprit que les chemins de type known folders comme %USERPROFILE\Downloads peuvent être configuré vers un chemin en dehors de l'arborescence de %USERPROFILE%.