20110608

How to Audit & Track file Deletions


  • Enable Audit Policy: On the machine where you want to track file deletion, go to Administrative Tools->Local Security Policy->Audit Policy , double click "Audit Object Access" on the right pane and switch-on "Success" & "Failure".
  • Enable auditing for user/group: You'll need to enable and add user/security group for auditing on the folder which needs to be captured for file deletion.
    • Right click on the target folder (ex. C:\Program Files\Honeywell), select Properties and go toSecurity Tab.
    • Click on Advanced , and select Auditing Tab.
    • Add here the security group which would include the user who you think might be deleting the file. If you are not sure, include EVERYONE .
    • On the next screen select "Successful" & "Failed" on "Delete subfolders and files" & "Delete". Apply new settings and exit from properties.

  • These configurations will generate file/folder access audit logs for the configured folder in Securit Event Logs . Since we are interested in only the logs that show details of file/folder deletions, we'll need to look for Security Logs with event ID 560 .
  • Any file deletion operation will generate two events with event ID 560. After you've realized that your target file has been deleted, you'll need to filter the security log view to show only logs with event ID 560 (right click on Event Viewer->Security, select Filter...).
  • If you quickly want to find out if your configured machine generated any file deletion event log, run the following command on your own (networked) machine. This will work only on XP and above, therefore, you can use this to query for security logs from Windows 2000 machines. Run cscript //h:cscript //s //nologo at least once on your system before executing the following command.
eventquery.vbs /S  /FI "ID eq 560" /L Security /V
/FI : Filter
/L : Log name {Application | Security | System}
/V : Verbose output

To know more about the above command, read here.
  • A typical security log with file deletion details will look something like this:
Event Type: Success Audit
Event Source: Security
Event Category: Object Access
Event ID: 560
User: GKY\Raj
Computer: GKY
Description:
Object Open:
Object Server: Security
Object Type: File
Object Name: D:\Test\testdoc.txt
Handle ID: 1756
Operation ID: {0,3190200}
Process ID: 4040
Image File Name: C:\WINDOWS\explorer.exe
Primary User Name: Raj
Primary Domain: GKY
Primary Logon ID: (0x0,0x40C41)
Client User Name: -
Client Domain: -
Client Logon ID: -
Accesses: DELETE
SYNCHRONIZE
ReadAttributes
NOTE:
  • Ensure that security log is set not to overwrite itself, and has sufficient size to hold logs spanning many days. You can configure these settings by right-clicking on Security subfolder inside Event Viewer.
  • You might want to test these settings by deleting few files yourself before assuming it'll deliver what you expect!

1 comment:

  1. Very good Post, thank for sharing this information related to track file or folder changes. It describes step by step process to track file/ folder deletion in windows and that display who is delete the files. I found this file access auditing tool (http://www.lepide.com/file-server-audit/file-access-auditing.html) which enables to track unauthorized access in file or folder and know what happening in the file/ folder and provides the complete detail audit information for every file/ folder access .

    ReplyDelete