Windows executable file
application/x-msdownload
⚠️
High Risk Format
This file type can contain executable code. Always validate source and scan with antivirus before opening.
Magic Bytes
Offset: 0
4D 5A
The Windows COM executable is a legacy binary format originally developed by Microsoft for MS-DOS and early Windows operating systems. Historically used for compact system utilities and command-line programs, it allowed for direct memory mapping within resource-constrained environments. Because this executable format is capable of arbitrary code execution, it presents a significant security risk and is frequently leveraged in malware attacks that exploit its nomenclature resemblance to internet top-level domains.
Validation Code
How to validate .com files in Python
Python
def is_com(file_path: str) -> bool:
"""Check if file is a valid COM by magic bytes."""
signature = bytes([0x4D, 0x5A])
with open(file_path, "rb") as f:
return f.read(2) == signature
How to validate .com files in Node.js
Node.js
function isCOM(buffer: Buffer): boolean {
const signature = Buffer.from([0x4D, 0x5A]);
return buffer.subarray(0, 2).equals(signature);
}
Go
func IsCOM(data []byte) bool {
signature := []byte{0x4D, 0x5A}
if len(data) < 2 {
return false
}
return bytes.Equal(data[:2], signature)
}
API Endpoint
GET
/api/v1/com
curl https://filesignature.org/api/v1/com