Trustwave and Cybereason Merge to Form Global MDR Powerhouse for Unparalleled Cybersecurity Value. Learn More

Trustwave and Cybereason Merge to Form Global MDR Powerhouse for Unparalleled Cybersecurity Value. Learn More

Services
Managed Detection & Response

Eliminate active threats with 24/7 threat detection, investigation, and response.

Co-Managed SOC (SIEM)

Maximize your SIEM investment, stop alert fatigue, and enhance your team with hybrid security operations support.

Advisory & Diagnostics

Advance your cybersecurity program and get expert guidance where you need it most.

Penetration Testing

Test your physical locations and IT infrastructure to shore up weaknesses before exploitation.

Database Security

Prevent unauthorized access and exceed compliance requirements.

Email Security

Stop email threats others miss and secure your organization against the #1 ransomware attack vector.

Digital Forensics & Incident Response

Prepare for the inevitable with 24/7 global breach response in-region and available on-site.

Firewall & Technology Management

Mitigate risk of a cyberattack with 24/7 incident and health monitoring and the latest threat intelligence.

Solutions
BY TOPIC
Microsoft Security
Unlock the full power of Microsoft Security
Offensive Security
Solutions to maximize your security ROI
Rapidly Secure New Environments
Security for rapid response situations
Securing the Cloud
Safely navigate and stay protected
Securing the IoT Landscape
Test, monitor and secure network objects
Why Trustwave
About Us
Awards and Accolades
Trustwave SpiderLabs Team
Trustwave Fusion Security Operations Platform
Trustwave Security Colony
Partners
Technology Alliance Partners
Key alliances who align and support our ecosystem of security offerings
Trustwave PartnerOne Program
Join forces with Trustwave to protect against the most advance cybersecurity threats
Loading...
Loading...

INFO: Why does TextCensor fail when tested against a file, despite the text being in the file?

Expand / Collapse


This article applies to:

  • Trustwave MailMarshal (SEG)
  • Trustwave ECM/MailMarshal Exchange

Question:

  • How does the MailMarshal Engine process different types of attachments within a message?
  • My TextCensor script is not triggering on a message that contains the specified text.
  • Why is a TextCensor script not triggering on an attachment?

Symptoms:

  • Testing of a TextCensor script fails when tested against an MML or other file, despite the text being in the email
  • Testing of a TextCensor script triggers when tested against an MML or other file, despite the text not existing anywhere in the email

Information:

A common reason for this issue is that the TextCensor test function does not "unpack" text from files in the same way as the MailMarshal Engine.

The test function built into the TextCensor scripts is intended to be used against readable text, not an MML or other complex file in its entirety. This fact may lead users to falsely conclude that there is something wrong with a TextCensor script that they have written, and that the TextCensor script they have created will incorrectly trigger or fail to trigger against an actual email message. This, however, is quite frequently not the case, due to the way that messages are actually processed by the MailMarshal Engine service.

To test a script against a message with attachments, send an actual test mail through MailMarshal.

Technical details:

If you examine an email message (MailMarshal MML file) using a test editor such as Notepad, you may see various sections within the message. Sections containing non-text attachments are specified as base64 encoded. The attachment will appear to be arbitrary non-human-readable characters; this is the base64 encoded section. This encoding allows binary data to be sent within an email message.

When processing the message, the Engine attempts to decode the base64 section into binary data. Once this is done, the Engine checks the binary signature to determine what type of file it is (for instance PDF, XLS, executable) and apply rules accordingly. You can see the results of this analysis in the service text logs for the message. 

In certain cases, such as with a PDF or Microsoft Word document, the Engine continues by unpacking the text from the file. Below is a sample of what might appear within the Engine log when a message such as this is unpacked:

0696 16:02:13.872 Thread 2 Starting to unpack <B418690980001.000000000001.0001.mml>
0696 16:02:15.528 Type=MAIL,  size=265313,  Name=B418690980001.000000000001.0001.mml
0696 16:02:15.528   Type=MHDR,  size=3175,  Name=MsgHeader.txt
0696 16:02:15.528   Type=MBODY,  size=110,  Name=Plain.txt
0696 16:02:15.528   Type=MBODY,  size=562,  Name=Quoted-Printable.txt
0696 16:02:15.528   Type=MAIL,  size=260828,  Name=Unknown.txt
0696 16:02:15.528     Type=MHDR,  size=3842,  Name=MsgHeader.txt
0696 16:02:15.528     Type=MBODY,  size=1443,  Name=Quoted-Printable.txt
0696 16:02:15.528     Type=MBODY,  size=8642,  Name=Quoted-Printable_1.txt
0696 16:02:15.528    
Type=PDF,  size=63339,  Name=Sample PDF file.pdf
0696 16:02:15.528       Type=TEXT,  size=4041,  Name=ExtractedText0.txt

Whenever a TextCensor script is set to apply to the "Message Attachment" portion, it actually scans the text extracted from the PDF file (in this example, ExtractedText0.txt). This temporary text file will appear completely different from the MML file in its entirety.

In order to accurately test the TextCensor script against only the body of a message that contains an attachment, the base64 encoded sections would need to be removed. If attempting to test the TextCensor script against the text contained within the attachment, the text would have to be manually extracted from the attachment and placed in a text file.

 

Notes:

See Also Q10855 : What file types are TextCensor scripts applied to by default?

This article was previously published as:
NETIQKB46650

To contact Trustwave about this article or to request support:


Rate this Article:
     
Tags:

Add Your Comments


Comment submission is disabled for anonymous users.
Please send feedback to Trustwave Technical Support or the Webmaster
.