
This is the office check script provided by cPanel for all the users who are using cPanel
ioc_checksessions_files.sh is a cPanel-provided detection script referenced in the official cPanel security advisory:
Security: CVE-2026-41940 - cPanel & WHM / WP2 Security Update 04/28/2026
The script is used to scan cPanel/WHM session files for suspicious indicators of compromise (IOCs), failed exploitation attempts, and confirmed exploitation artifacts related to CVE-2026-41940.
CVE-2026-41940 is an authentication bypass issue affecting cPanel software, including DNSOnly, and WP2. The advisory recommends immediate patching and provides this detection script to help administrators identify possible compromise indicators within session files.
This script is useful for:
This detection script is based on the tool provided by cPanel in its official advisory:
Security: CVE-2026-41940 - cPanel & WHM / WP2 Security Update 04/28/2026
According to the cPanel advisory change log:
04/29/26 02:46PM CST: Updated article's required actions and added detection script.
05/01/26 08:05AM CST: Temporarily removed the current detection script while we confirm a new version.
05/01/26 11:52AM CST: An updated version of the detection script has been added. This addresses scenarios where false positives were being detected.
Administrators should always validate they are using the latest version of the script from the official cPanel advisory before running it in production.
The script checks session files located under the cPanel session directory and identifies suspicious patterns such as:
cp_security_token valuesbadpass session origin combined with abnormal authentication markerstoken_denied indicatorsRun the script using Bash:
/bin/bash ./ioc_checksessions_files.sh
Optional flags may be available depending on the version of the script provided by cPanel:
/bin/bash ./ioc_checksessions_files.sh --help
Common options shown in the advisory script include:
--verbose
--purge
--yes or -y
--sessions-dir DIR
--access-log FILE
--help or -h
After execution, the script generates a scan summary similar to the example below:
=================================================================
SCAN SUMMARY
=================================================================
CRITICAL findings: 1
WARNING findings: 0
ATTEMPT findings: 1
INFO findings: 0
Total : 2
-----------------------------------------------------------------
=================================================================
SESSION: /var/cpanel/sessions/raw/:cusK9ghEd6MPo4eW
=================================================================
Findings:
[ATTEMPT ] Failed exploit attempt (badpass origin, token_denied, no auth markers, anomalous pass= line)
=================================================================
SESSION: /var/cpanel/sessions/raw/:TMnjH0tBK6jP2V3I
=================================================================
Findings:
[CRITICAL] Exploitation artifact - token_denied with injected cp_security_token (badpass origin, token used)
| Severity | Description |
|---|---|
CRITICAL |
If indicators of compromise are detected, the script may display an alert similar to:
[!] INDICATORS OF COMPROMISE DETECTED - IMMEDIATE ACTION REQUIRED
When this alert appears, treat the system as potentially compromised until verified otherwise.
If CRITICAL findings are identified, perform the following actions immediately:
root and all WHM users./var/log/wtmp and WHM access logs for unauthorized access.Before relying only on IOC detection results, administrators should ensure that affected cPanel/WHM or WP2 systems are patched according to the official cPanel advisory.
Recommended verification commands from the advisory include:
/scripts/upcp --force
/usr/local/cpanel/cpanel -V
/scripts/restartsrv_cpsrvd --hard
If a server is pinned to a specific cPanel version or automatic updates are disabled, administrators should manually verify that the server has been updated to a patched version.
Security teams should review the following locations during investigation:
/var/cpanel/sessions/raw/
/var/cpanel/sessions/preauth/
/var/log/wtmp
/usr/local/cpanel/logs/access_log
/usr/local/cpanel/logs/login_log
/root/.ssh/authorized_keys
/etc/cron*
/var/spool/cron/
During investigation, review the following:
This README is intended to document the usage of the cPanel-provided detection script for defensive security monitoring, incident response, and authorized system administration only.
Use this script only on systems where you have explicit authorization to perform security investigation activities.
Always refer to the official cPanel advisory for the latest instructions, patched versions, mitigations, and script updates.
| Indicates a confirmed or highly suspicious exploitation artifact requiring immediate action. |
WARNING | Indicates suspicious behavior or weak indicators that should be reviewed further. |
ATTEMPT | Indicates a failed exploit attempt or suspicious request pattern. |
INFO | Provides informational findings that may help with investigation or correlation. |