OBLYTECH Logo
OBLYTECH Logo

Search for and delete phishing emails in Security Operations

Phishing emails can be searched for and deleted from the email server through a security incident. Open the Email Search related list, add search criteria, and select Search on Email Server(s) to count the matches. Deletion then runs through an approval step, which lets you check the count before any email is removed.

A phishing campaign rarely lands in one mailbox. The same message often reaches many people, and the analyst who takes the first report usually has just one copy in front of them. The Email Search feature in ServiceNow Security Operations lets you find the other copies from inside the incident, count them, and decide what to remove. If you are new to the module, read the plain-language guide to ServiceNow Security Operations first, then come back to the steps below.

Roles and limits to confirm first

Two roles apply here, and they cover different parts of the work. The search feature requires the sn_sec_cmn.cap_email_read role. The Security Operations Integration – Email Search and Delete flow requires sn_si.analyst. Check that the people who will run searches hold the role for each step before an incident starts, so the work does not stall in the middle of a response.

The feature lists Microsoft Exchange Server 2010 as its supported software. Searches of the message body are limited to 1,500 mailboxes, so scope a body search to a set of mailboxes inside that ceiling. The Search Text field does not support single quotation marks, double quotation marks or colons. Limits and supported software can change between releases, so confirm them on your own instance before you build a response process around them.

Creating the email search on a security incident

The search record belongs to the security incident, so start from the incident that the phishing report opened. Give the record a specific name and description, because you will return to them when you review results or hand the incident to someone else.

  1. Navigate to All > Security Incident > Show Open Incidents, and choose the incident.
  2. If the Email Search related list is not visible, select the Show All Related Links related link.
  3. Select the Email Search related list, then select New.
  4. Enter a Name for the search query and a Description that states what the query is looking for.
  5. Select and hold (or right-click) in the form header, then select Save.

The Query from criteria field shows a preview of the query that runs on the email server. The preview is generated from the active search criteria records, so add those before you read it.

Adding search criteria and choosing what to search

Each criteria record carries one search field and one piece of text to look for. Select the Email Search Criteria tab, select New, and fill in the fields.

  • Email search shows the name of the parent search. You can change it.
  • Search field sets where the criteria looks on the email server. The choices are listed below.
  • Search Text holds the text to find.
  • Active includes the criteria record in the query when it is selected.
  • Operator takes AND or OR and sets how the criteria combine on the email server.
  • Order sets the sequence in which the query is built from the criteria.

The Search field choices work as follows.

  • Subject matches the subject line. The results include the total count and details for each email: date received, read status, recipient and message ID.
  • From matches the sender’s full email address and returns the same details.
  • Recipient matches a full address in the To, Cc and Bcc fields and returns the same details.
  • Body matches the message text and returns the total count of matching emails.
  • Cc and Bcc match a full address in those fields and return the total count.
  • Attachment matches either an attachment file name or attachment contents. Content matching supports plain text attachments.
  • Retention Policy matches retention policy numbers and returns the total count.

Choosing between AND and OR

Use AND when a message must match several traits, such as a known sender with a particular subject line. Use OR when a campaign rotates subject lines or sender addresses and you want any of them. Set the Order values so the query reads the way you planned it when you come back to review it. From and Recipient cannot appear in the same query, so when you need both, run two searches and compare the counts.

Running the search and reading the results

When the criteria are saved, select Search on Email Server(s). The search can take some time to complete, and the count comes back before any deletion can start. Open the Email Search Results tab to see the matches. Each line in the Email Search Result Entries form is a separate email, so one row is one message.

Read the rows, not just the total. Look for recipients outside the group you expected, sender addresses that do not fit the campaign pattern, and the read status of each match. Read status shows whether the matched email was marked as read. Keep a note of the query you ran and the count it returned, so the decision to delete can be traced later.

Deleting the matched emails after approval

Deletion is a separate action from searching. Select Delete from Email Server(s) on the Email Search form. That button starts the Security Operations Integration – Email Search and Delete flow. The flow works from the email server search, returns the number of threat emails and, where requested, details for each email found. After the count is received, approval is required before any emails are deleted.

Review the count and the sample rows before the approval is given, because approval is the point where the emails are removed from the server. Agree in advance who gives that approval, so the step does not wait on a person who was not expecting it during an incident.

For help planning this work, see ServiceNow implementation.

Checks to run before and after a deletion

The checks below apply to this feature. For the module as a whole, start at the Security Operations hub, and use the best practices guide for the broader program.

  1. Confirm the roles for each step: sn_sec_cmn.cap_email_read for the search and sn_si.analyst for the Email Search and Delete flow.
  2. Read the query preview, confirm that each criteria record you need is active, and confirm the Operator matches what you intend.
  3. If the criteria include Body, confirm the mailboxes in scope stay within the 1,500 mailbox limit.
  4. Review the rows on the Email Search Results tab for unexpected recipients or senders.
  5. Compare the count with the recipients already named in the incident, and note any gap for the investigation.
  6. After the deletion completes, run the same search again and record the count it returns beside the count you approved.

Common problems with phishing email searches

Many search problems come from the criteria rather than the feature itself. These are the ones that show up when criteria are built quickly during an incident.

  • Punctuation in Search Text. Single quotation marks, double quotation marks and colons are not supported. Remove them and search the words around them.
  • A preview that does not match your plan. The Query from criteria preview is generated from active criteria records. Reopen each record and check its Active setting.
  • From and Recipient together. These fields cannot be combined in one query. Run them as separate searches.
  • Attachment contents that do not match. Content matching supports plain text attachments. For other file types, search the attachment file name.
  • No Email Search list on the incident. Select Show All Related Links on the incident, then select the Email Search related list.

For the wider pitfalls in setting up the module, see the common Security Operations mistakes guide before the first live incident.

Questions about running email searches and deletions

How narrow should the first search be?

Start with the criteria that identify the message more precisely, usually a subject fragment or the sender address, and check the count. Widen the search with an OR criteria once you have evidence that the campaign uses other values. A broad first search tends to pull in legitimate mail with similar wording, which slows the review.

What should I check when the count is higher than expected?

Start with the Operator. An OR where you meant AND widens the result quickly. Then open the Email Search Results tab and compare the recipients and sender addresses in the rows against the campaign you are investigating. If the extra matches share a pattern, such as a repeated subject phrase, they may belong to a second campaign and need a separate search.

What does a count of zero tell me?

A count of zero shows that the saved criteria did not match anything on the email server. Before you conclude that the message is gone, check the Search field, the spelling in Search Text, any punctuation the field does not support, and whether each criteria record is active. Then compare the search values with the original message in the incident.

Should I delete before the investigation finishes?

The search answers the question of scope, and the investigation answers what the message did to the people who received it. Removing emails as soon as the count arrives can take away material the investigation still needs, so agree on the order of those steps before anyone is asked to approve a deletion.