Atlantiraptor Docs

Windows.Forensics.RecycleBin

Type: Client · Author: Zach Stanford - @svch0st

Parses Recycle Bin $I metadata files to recover deleted file names, original paths, and deletion timestamps.

Supports Recycle Bin format found in Vista onwards. This will not parse INFO2 files found in the “Recycler” folder from XP and below.

The layout of the Recycle Bin folder is in the in the form:

  C:\$Recycle.Bin\%SID%\

Each folder contains the following files:

$R###### files; the original data
$I###### files; the "Recycled" file's metadata

The first file begins with the value $R followed by a random string – “this file contains the actual contents of the recycled file”

The second file begins with $I and ends in the same string as the $R file – this file contains the metadata for that specific file

The artifact has two modes:

  • API (default) uses the OS API to read the $I files currently in the bins matched by RecycleBinGlobs.
  • MFT parses the $MFT of every NTFS volume and also returns $I records that are no longer allocated, for example after the bin was emptied or the item restored. $I files are small enough to be stored inside their MFT record, so their metadata stays readable until NTFS reuses the record. Such rows have InUse set to false. This mode is slower and requires raw disk access.

Precondition: SELECT OS From info() where OS = 'windows'

Parameters

Name Type Default Description
Mode choices API API reads the $I files currently in the bin. MFT also recovers $I records left behind after the bin was emptied.
RecycleBinGlobs string C:\$Recycle.Bin\**\$I* Glob for $I files (API mode only).
IndexFileRegex regex ^\$I[A-Z0-9]{6} File name regex for $I records (MFT mode only).
AlsoUpload bool Also upload recovered files. In MFT mode only items still in the bin are uploaded.

References

Source

Defined in artifacts/definitions/Windows/Forensics/RecycleBin.yaml.

name: Windows.Forensics.RecycleBin
description: |
  Parses Recycle Bin `$I` metadata files to recover deleted file names,
  original paths, and deletion timestamps.
 
  Supports Recycle Bin format found in Vista onwards. This will not
  parse INFO2 files found in the "Recycler" folder from XP and below.

  The layout of the Recycle Bin folder is in the in the form:
  ` ` `
    C:\$Recycle.Bin\%SID%\
  ` ` `

  Each folder contains the following files:
  ` ` `
  $R###### files; the original data
  $I###### files; the "Recycled" file's metadata
  ` ` `

  The first file begins with the value `$R` followed by a random string
  – "this file contains the actual contents of the recycled file"

  The second file begins with `$I` and ends in the same string as the
  `$R` file – this file contains the metadata for that specific file

  The artifact has two modes:

  * `API` (default) uses the OS API to read the `$I` files currently
    in the bins matched by `RecycleBinGlobs`.
  * `MFT` parses the `$MFT` of every NTFS volume and also returns `$I`
    records that are no longer allocated, for example after the bin
    was emptied or the item restored. `$I` files are small enough to
    be stored inside their MFT record, so their metadata stays
    readable until NTFS reuses the record. Such rows have `InUse` set
    to false. This mode is slower and requires raw disk access.

author: "Zach Stanford - @svch0st"

reference:
  - https://forensicswiki.xyz/wiki/index.php?title=Windows#Recycle_Bin
  - https://www.magnetforensics.com/blog/artifact-profile-recycle-bin/
  - https://github.com/Velocidex/velociraptor/issues/1521


parameters:
    - name: Mode
      type: choices
      default: API
      choices:
        - API
        - MFT
      description: |
        API reads the $I files currently in the bin. MFT also recovers
        $I records left behind after the bin was emptied.

    - name: RecycleBinGlobs
      description: Glob for $I files (API mode only).
      default: C:\$Recycle.Bin\**\$I*

    - name: IndexFileRegex
      type: regex
      description: File name regex for $I records (MFT mode only).
      default: ^\$I[A-Z0-9]{6}

    - name: AlsoUpload
      type: bool
      description: |
        Also upload recovered files. In MFT mode only items still in
        the bin are uploaded.

precondition: SELECT OS From info() where OS = 'windows'

sources:
  - query: |
        -- MFT mode: every $I record on every NTFS volume, allocated
        -- or not. Shadow copies are skipped to avoid duplicates.
        LET ntfs_drives = SELECT OSPath AS Drive
          FROM glob(globs="/*", accessor="ntfs")
          WHERE NOT OSPath =~ "ShadowCopy"
            AND log(message="Processing " + OSPath + "$MFT")

        LET mft_hits = SELECT * FROM foreach(
              row=ntfs_drives,
              query={
                SELECT Drive, OSPath, InUse, EntryNumber
                FROM parse_mft(filename=Drive + "$MFT",
                               accessor="ntfs", prefix=Drive)
                WHERE FileName =~ IndexFileRegex AND NOT IsDir
              })

        -- Freed records have no directory entry, so read their
        -- resident $DATA by MFT entry number instead of by path.
        LET mft_mode = SELECT * FROM foreach(
              row=mft_hits,
              query={
                SELECT
                    timestamp(winfiletime=DeletedTime) as DeletedTimestamp,
                    FilePath as OriginalFilePath,
                    FileSize,
                    OSPath,
                    regex_replace(source=OSPath, re="\\\\\\$I", replace="\\$$R") AS RecyclePath,
                    InUse,
                    EntryNumber AS MFTId,
                    if(condition=AlsoUpload AND InUse, then=upload(
                         file=regex_replace(source=OSPath, re="\\\\\\$I", replace="\\$$R"),
                         accessor="ntfs",
                         name=FilePath
                    )) AS Upload
                 FROM parse_recyclebin(filename=Drive + str(str=EntryNumber),
                                       accessor="mft")
              })

        LET api_mode = SELECT * FROM foreach(
              row={
                 SELECT OSPath FROM glob(globs=RecycleBinGlobs)
              },
              query={
                SELECT
                    timestamp(winfiletime=DeletedTime) as DeletedTimestamp,
                    Name,
                    FilePath as OriginalFilePath,
                    FileSize,
                    OSPath,
                    regex_replace(source=OSPath, re="\\\\\\$I", replace="\\$$R") AS RecyclePath,
                    if(condition=AlsoUpload, then=upload(
                         file=regex_replace(source=OSPath, re="\\\\\\$I", replace="\\$$R"),
                         name=FilePath
                    )) AS Upload
                 FROM parse_recyclebin(filename=OSPath)
              })

        SELECT * FROM if(condition=Mode = "MFT",
                         then=mft_mode,
                         else=api_mode)

Edit this page on GitHub

© 2026 Atlant Security EOOD. Atlantiraptor is free software under the GNU Affero General Public License v3. It is based on Velociraptor by Velocidex, and keeps its copyright notices. Velociraptor is a trademark of its owner; Atlantiraptor is not affiliated with or endorsed by it.