This detection rule identifies the presence of pscan2.c, a source code file commonly associated with post-exploitation reconnaissance and network scanning tools used by adversaries to map Linux environments. SOC teams should proactively hunt for this artifact in Azure Sentinel because its appearance often signals an attacker’s early-stage information gathering phase, enabling timely intervention before lateral movement or data exfiltration occurs.
rule LinuxHacktool_eyes_pscan2_2 {
meta:
description = "Linux hack tools - file pscan2.c"
author = "Florian Roth"
reference = "not set"
date = "2015/01/19"
hash = "eb024dfb441471af7520215807c34d105efa5fd8"
strings:
$s0 = "snprintf(outfile, sizeof(outfile) - 1, \"scan.log\", argv[1], argv[2]);" fullword ascii
$s2 = "printf(\"Usage: %s <b-block> <port> [c-block]\\n\", argv[0]);" fullword ascii
$s3 = "printf(\"\\n# pscan completed in %u seconds. (found %d ips)\\n\", (time(0) - sca" ascii
$s19 = "connlist[i].addr.sin_family = AF_INET;" fullword ascii
$s20 = "snprintf(last, sizeof(last) - 1, \"%s.%d.* (total: %d) (%.1f%% done)\"," fullword ascii
condition:
2 of them
}
This YARA rule can be deployed in the following contexts:
This rule contains 5 string patterns in its detection logic.
Here are 5 specific false positive scenarios for the Linux hack tools - file pscan2.c detection rule, including targeted filters and exclusions:
Scenario: Developer Environment Compilation
pscan2.c is compiled into an executable during the daily “Build & Test” stage of the Jenkins/GitLab runner workflow.jenkins-agent, gitlab-runner) or located within standard build directories like /var/lib/jenkins/workspace or /home/dev/builds.Scenario: Scheduled Security Audit Script
pscan2.c from an internal repository before execution to ensure the latest logic is used for compliance reporting.cron or systemd-cron, specifically when the file path matches /opt/security-audit/scripts/pscan2.c.Scenario: Automated Patch Management Deployment
pscan2.c as part of the agent’s core module update on all Linux bastion hosts.ansible, salt-minion) or the file path resides in `/opt/internal-monitoring