Listen to this Post
In the latest version of 7zip, if you open a macro-enabled file within 7zip, the Mark of the Web (MOTW) will propagate. However, if you add a file to multiple 7zip archives and extract all but the last one, and then open the last file within 7zip, MOTW disappears. This behavior can have significant security implications, especially when dealing with potentially malicious files.
You Should Know:
- Mark of the Web (MOTW): MOTW is a security feature in Windows that tags files downloaded from the internet. This tag helps Windows Defender and other security tools to treat these files with extra caution.
-
7zip and MOTW Propagation: When you open a macro-enabled file (like a Word document with macros) within 7zip, MOTW is supposed to propagate to the extracted file. However, the behavior changes if you manipulate the file across multiple archives.
-
Security Implications: If MOTW disappears, it could mean that the file is no longer flagged as potentially dangerous, which could lead to security vulnerabilities if the file is malicious.
Practical Steps and Commands:
1. Check MOTW on a File:
- Use the following PowerShell command to check if a file has the MOTW attribute:
Get-Item -Path "C:\path\to\file.zip" | Select-Object -ExpandProperty Attributes
- Look for the `Archive, NotContentIndexed` attributes. If MOTW is present, it will also show
ReadOnly.
2. Manually Add MOTW:
- If you need to manually add MOTW to a file, you can use the following PowerShell command:
Set-ItemProperty -Path "C:\path\to\file.zip" -Name IsReadOnly -Value $true
3. Extract Files Safely:
- Always extract files to a temporary directory and check their MOTW status before opening them:
7z x file.zip -o/tmp/extract_here
4. Verify MOTW After Extraction:
- After extraction, verify the MOTW status again using the PowerShell command mentioned above.
5. Automate MOTW Checks:
- You can automate MOTW checks using a simple script:
$files = Get-ChildItem -Path "C:\path\to\extracted\files" -Recurse foreach ($file in $files) { $attributes = Get-ItemProperty -Path $file.FullName -Name Attributes if ($attributes -notmatch "ReadOnly") { Write-Host "MOTW missing on $($file.FullName)" } }
What Undercode Say:
Understanding how MOTW propagates in 7zip is crucial for maintaining security when handling files from untrusted sources. Always verify the MOTW status of files after extraction, and consider automating these checks to ensure that no potentially dangerous files slip through the cracks. Use the provided PowerShell commands to manually check and set MOTW attributes, and always extract files to a secure location before opening them.
For more information on MOTW and its implications, you can refer to the official Microsoft documentation: Mark of the Web.
References:
Reported By: Mertdas In – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅



