- Forum
- Main Forum
- English Section
- Server Security
- CWP Server Root Compromise via External API Port 2304 – Real Incident Analysis
×
Presentation and instructions about security tools used to prevent server hacking. Feel free to use them or ask us to protect your site hosting it to a safe, daily monitored vps senter. Freespirits will ensure great quality of services.
CWP Server Root Compromise via External API Port 2304 – Real Incident Analysis
- infogate
-
Συντάκτης θέματος
- Αποσυνδεμένος
- Administrator
-
- Imagination is the beginning of creation
2 Ημέρες 12 Ώρες πριν #353
από infogate
The best possible way to start your online marketing : fspirits.com/go/leadsleap-home
Create Amazing AI Videos : fspirits.com/go/video-express-ai
Start your affiliate journey here: fspirits.com/go/olsp-academy
Edit And Create Videos: fspirits.com/go/create-studio-pro
Best Solution To Create Graphics: fspirits.com/go/artistly
Smart Chat Automation: fspirits.com/go/chatterpal
Multi-Purpose Video Maker: fspirits.com/go/avatar-builder
Multi-Purpose Video Creator: fspirits.com/go/videocreator
AI Human Spokesperson Videos: fspirits.com/go/humanpal
CWP Server Root Compromise via External API Port 2304 – Real Incident Analysis δημιουργήθηκε από infogate
CWP Server Root Compromise via External API Port 2304 – Real Incident Analysis and Recovery
Introduction
I recently investigated a serious security incident on a production CWP7 server running AlmaLinux.
What initially looked like a compromised Joomla website eventually turned out to be something much more serious: the entire server had obtained unauthorized root-level access.
The investigation uncovered:
This article documents the investigation, indicators of compromise, containment steps and lessons learned.
Important: This article is written from a defensive system-administration perspective. It intentionally does not reproduce the malicious exploit payload.
1. How the Incident Was First Detected
The investigation started after unexpected changes were detected inside one hosted Joomla website.
Files such as:
appeared or changed unexpectedly.
One website also started serving gambling/SEO spam related to "LAMTOTO", while another site contained a similar malicious page.
At first, the obvious suspicion was:
However, the timestamps did not fit that theory.
Files belonging to unrelated hosting accounts were being modified by:
That immediately changed the scope of the investigation.
This was no longer a single compromised website.
The server itself had to be considered compromised.
2. Cross-Account Activity
A particularly useful indicator was a tiny file named:
The same file appeared across numerous unrelated hosting accounts.
Its content was identical:
More importantly, web-server logs showed requests for this file coming from the server's own IPv4 and IPv6 addresses using:
This strongly indicated that a local script running on the server was creating or testing files across multiple hosting accounts.
That is not normal website-level malware behavior.
A compromised Joomla account normally cannot freely write into unrelated customers' home directories.
Root access can.
3. The CWP External API Became the Main Suspect
CWP uses TCP port:
for its External API.
The API configuration on the affected server contained:
and forwarded PHP requests to:
The associated PHP-FPM pool configuration was then checked.
The result was critical:
Running processes confirmed it:
This means that code successfully executed through this privileged CWP API path can execute with root privileges.
4. Suspicious Requests to /v1/backup
The CWP API access log showed repeated requests from:
against:
The timeline included:
The final August responses were considerably larger than the earlier responses.
CWP's debug log showed that:
was rewritten internally to:
and handled by CWP's API application.
5. The Smoking Gun: CWP API Log
The most important evidence was eventually found in:
Entries associated with the backup API contained attacker-supplied shell execution.
The log clearly showed a backup operation followed by:
and subsequent communication with infrastructure associated with:
The injected code performed filesystem/domain reconnaissance and contacted an external HTTP service.
At this point there was little ambiguity left.
The compromise chain was essentially:
The earliest confirmed successful execution discovered during the investigation was:
The later August activity was therefore not the original compromise.
It was continued access to an already vulnerable server.
6. Root Persistence Through GSocket
Root shell history contained several highly suspicious commands involving:
One malicious binary was installed as:
This is particularly deceptive because:
is normally an SSH private key.
But:
was an executable binary.
Its SHA256 was:
The binary communicated with:
and was associated with GSocket/gs-netcat functionality.
7. Systemd Persistence Disguised as a Kernel Process
The attacker created a systemd service configured approximately as:
The executable was launched using a fake process name:
This was clever because Linux systems can legitimately contain a kernel workqueue named:
The difference is critical.
The malicious process had a userspace executable:
A genuine kernel thread does not point to a normal userspace executable through:
The service automatically restarted approximately five minutes after being killed because it had:
Simply killing the process therefore did not remove the backdoor.
The systemd persistence had to be stopped and masked.
8. Additional Suspicious System Files
Three additional files appeared during the compromise window:
The most significant was:
Characteristics included:
The old modification timestamp was clearly inconsistent with its filesystem birth time.
This is a common anti-forensic technique called timestamp manipulation or timestomping.
The file was preserved for evidence and then removed from its active system location.
9. Website-Level Damage
After obtaining root access, the attacker affected several hosted websites.
Observed behavior included:
One particularly dangerous lesson was that a website could appear repaired while malicious content was still being served from Nginx FastCGI cache.
After restoring clean website files, one domain continued serving the malicious page.
The filesystem looked clean.
A unique query parameter showed a clean page.
The normal URL showed the old malicious page.
The reason was stale Nginx cache.
Purging:
resolved the stale output.
Therefore:
Never assume that restoring filesystem files automatically removes cached malicious pages.
10. Immutable Webroot Attributes
Some public_html directories had the immutable filesystem attribute:
This can be checked using:
Example:
An immutable directory cannot be modified normally, even by the hosting user.
During incident response this can cause confusing symptoms such as:
To remove an unexpected immutable flag:
However, do not automatically remove immutable flags everywhere.
Some administrators deliberately use them as a protection mechanism.
Check timestamps and history first.
11. Immediate Containment
The malicious systemd service was:
The executable was preserved for forensic purposes and removed from:
The attacker's C2 IP was blocked in CSF.
The suspected CWP attacker IP was also blocked:
Most importantly, CWP External API port 2304 was removed from:
in:
Then CSF was reloaded:
Verification:
There should be no rule similar to:
CWP itself may continue listening locally:
That does not automatically mean it is reachable from the Internet.
The firewall is what determines external reachability.
12. Recommended CWP Configuration
If you do not actively use:
there is little reason to expose:
to the entire Internet.
A much safer architecture is:
If the API is genuinely required, restrict access to specific trusted IP addresses rather than:
13. Useful Detection Commands
Check port 2304:
Check CWP API access:
Check suspicious CWP API execution:
Check GSocket indicators:
Check known C2 connections:
Check suspicious files:
Check suspicious systemd references:
Check immutable webroots:
Check recent root-owned website files:
14. Indicators of Compromise
Indicators found during this incident included:
Indicators should never be treated individually as automatic proof of compromise.
Context matters.
For example, a historical log containing an IOC after cleanup does not mean the malicious process is currently active.
15. Security Audit Script
After the incident I created a read-only audit script that can be deployed across CWP/Linux servers.
The audit checks:
An important design decision was:
The audit detects and reports. It does not automatically delete or repair anything.
Automatic malware removal on a production server can easily destroy legitimate data or forensic evidence.
16. SPF / DKIM / DMARC and Security Reports
Another problem discovered during the investigation was that security audit emails were not arriving in Gmail.
Postfix showed:
The server's hostname had no suitable SPF record and DKIM was not published.
For the server hostname, an SPF record was added similar to:
After DNS propagation:
should return the SPF record.
If DMARC is:
mail authentication must be configured correctly or Gmail may reject automated security reports.
17. Important Lesson About Root Passwords
Changing the root password is important after compromise.
However:
Changing the root password does not fix an unauthenticated remote code execution vulnerability.
If the attacker entered through a public CWP API vulnerability, they never needed the root password.
Therefore the correct order is:
Passwords are only one part of the recovery process.
18. Can the Existing Server Be Trusted Again?
This is the most important conclusion.
Once an attacker has obtained unrestricted root access, it is impossible to prove with certainty that every modification has been discovered.
Root can alter:
Removing the known malware is therefore containment, not restoration of trust.
The safest recovery procedure after confirmed root compromise remains:
19. Major Lessons Learned
The biggest lessons from this incident were:
20. Final Conclusion
What initially appeared to be a Joomla SEO-spam infection turned out to be a complete server compromise.
The key evidence showed:
The incident demonstrates why server administrators should never limit an investigation to the website where the first symptoms appear.
A compromised site can be the victim of a much deeper server-level intrusion.
If you operate CWP servers, I strongly recommend reviewing whether External API port 2304 needs to be exposed at all, auditing /var/log/cwp/cwp_api.log, reviewing privileged PHP-FPM pools, monitoring unexpected root-owned website files and maintaining off-server clean backups.
And most importantly: if root compromise is confirmed, cleaning visible malware should be considered temporary containment — not proof that the server is trustworthy again.
Introduction
I recently investigated a serious security incident on a production CWP7 server running AlmaLinux.
What initially looked like a compromised Joomla website eventually turned out to be something much more serious: the entire server had obtained unauthorized root-level access.
The investigation uncovered:
This article documents the investigation, indicators of compromise, containment steps and lessons learned.
Important: This article is written from a defensive system-administration perspective. It intentionally does not reproduce the malicious exploit payload.
1. How the Incident Was First Detected
The investigation started after unexpected changes were detected inside one hosted Joomla website.
Files such as:
index-old.php
index-ori.php
index.html
google*.htmlappeared or changed unexpectedly.
One website also started serving gambling/SEO spam related to "LAMTOTO", while another site contained a similar malicious page.
At first, the obvious suspicion was:
Joomla compromise
vulnerable plugin
outdated extension
PHP webshellHowever, the timestamps did not fit that theory.
Files belonging to unrelated hosting accounts were being modified by:
root:rootThat immediately changed the scope of the investigation.
This was no longer a single compromised website.
The server itself had to be considered compromised.
2. Cross-Account Activity
A particularly useful indicator was a tiny file named:
test123zzThe same file appeared across numerous unrelated hosting accounts.
Its content was identical:
TESTPAGE_1787038851More importantly, web-server logs showed requests for this file coming from the server's own IPv4 and IPv6 addresses using:
curl/7.76.1This strongly indicated that a local script running on the server was creating or testing files across multiple hosting accounts.
That is not normal website-level malware behavior.
A compromised Joomla account normally cannot freely write into unrelated customers' home directories.
Root access can.
3. The CWP External API Became the Main Suspect
CWP uses TCP port:
2304for its External API.
The API configuration on the affected server contained:
listen 2304 ssl;and forwarded PHP requests to:
/usr/local/cwp/php71/var/sockets/cwpsrv.sockThe associated PHP-FPM pool configuration was then checked.
The result was critical:
user = root
group = rootRunning processes confirmed it:
php-fpm: pool cwpsrv
USER: root
GROUP: rootThis means that code successfully executed through this privileged CWP API path can execute with root privileges.
4. Suspicious Requests to /v1/backup
The CWP API access log showed repeated requests from:
146.103.45.130against:
POST /v1/backupThe timeline included:
24 July 2026 -> HTTP 400
25 July 2026 -> HTTP 400
31 July 2026 -> HTTP 200
31 July 2026 -> multiple HTTP 200 responses
06 August 2026 -> HTTP 200
17 August 2026 -> HTTP 200
18 August 2026 -> HTTP 200The final August responses were considerably larger than the earlier responses.
CWP's debug log showed that:
/v1/backupwas rewritten internally to:
/v1/index.phpand handled by CWP's API application.
5. The Smoking Gun: CWP API Log
The most important evidence was eventually found in:
/var/log/cwp/cwp_api.logEntries associated with the backup API contained attacker-supplied shell execution.
The log clearly showed a backup operation followed by:
bash -cand subsequent communication with infrastructure associated with:
146.103.45.130The injected code performed filesystem/domain reconnaissance and contacted an external HTTP service.
At this point there was little ambiguity left.
The compromise chain was essentially:
Internet
|
v
TCP 2304
|
v
CWP External API
|
v
POST /v1/backup
|
v
/v1/index.php
|
v
cwpsrv PHP-FPM
user=root
|
v
ROOT COMMAND EXECUTIONThe earliest confirmed successful execution discovered during the investigation was:
31 July 2026The later August activity was therefore not the original compromise.
It was continued access to an already vulnerable server.
6. Root Persistence Through GSocket
Root shell history contained several highly suspicious commands involving:
gsocket.io
memek.cc
localroot.sbsOne malicious binary was installed as:
/usr/bin/id_rsaThis is particularly deceptive because:
~/.ssh/id_rsais normally an SSH private key.
But:
/usr/bin/id_rsawas an executable binary.
Its SHA256 was:
d94f75a70b5cabaf786ac57177ed841732e62bdcc9a29e06e5b41d9be567bcfaThe binary communicated with:
212.132.98.170:443and was associated with GSocket/gs-netcat functionality.
7. Systemd Persistence Disguised as a Kernel Process
The attacker created a systemd service configured approximately as:
Description=D-Bus System Connection Bus
Restart=always
RestartSec=300The executable was launched using a fake process name:
[kaluad]This was clever because Linux systems can legitimately contain a kernel workqueue named:
kaluadThe difference is critical.
The malicious process had a userspace executable:
/usr/bin/id_rsaA genuine kernel thread does not point to a normal userspace executable through:
/proc/PID/exeThe service automatically restarted approximately five minutes after being killed because it had:
Restart=always
RestartSec=300Simply killing the process therefore did not remove the backdoor.
The systemd persistence had to be stopped and masked.
8. Additional Suspicious System Files
Three additional files appeared during the compromise window:
/usr/sbin/authd
/usr/sbin/bootcfg
/usr/sbin/firewallctlThe most significant was:
/usr/sbin/authdCharacteristics included:
Owner: root
Not owned by any RPM package
Birth time: 18 August 2026
Modification timestamp: October 2013The old modification timestamp was clearly inconsistent with its filesystem birth time.
This is a common anti-forensic technique called timestamp manipulation or timestomping.
The file was preserved for evidence and then removed from its active system location.
9. Website-Level Damage
After obtaining root access, the attacker affected several hosted websites.
Observed behavior included:
- Immutable public_html directories
One particularly dangerous lesson was that a website could appear repaired while malicious content was still being served from Nginx FastCGI cache.
After restoring clean website files, one domain continued serving the malicious page.
The filesystem looked clean.
A unique query parameter showed a clean page.
The normal URL showed the old malicious page.
The reason was stale Nginx cache.
Purging:
/var/cache/nginx/fastcgiresolved the stale output.
Therefore:
Never assume that restoring filesystem files automatically removes cached malicious pages.
10. Immutable Webroot Attributes
Some public_html directories had the immutable filesystem attribute:
iThis can be checked using:
lsattr -d /home/USERNAME/public_htmlExample:
----i----------------- /home/example/public_htmlAn immutable directory cannot be modified normally, even by the hosting user.
During incident response this can cause confusing symptoms such as:
To remove an unexpected immutable flag:
chattr -i /home/USERNAME/public_htmlHowever, do not automatically remove immutable flags everywhere.
Some administrators deliberately use them as a protection mechanism.
Check timestamps and history first.
11. Immediate Containment
The malicious systemd service was:
stopped
disabled
maskedThe executable was preserved for forensic purposes and removed from:
/usr/bin/id_rsaThe attacker's C2 IP was blocked in CSF.
The suspected CWP attacker IP was also blocked:
146.103.45.130Most importantly, CWP External API port 2304 was removed from:
TCP_INin:
/etc/csf/csf.confThen CSF was reloaded:
csf -rVerification:
csf -g 2304There should be no rule similar to:
INPUT ACCEPT tcp dpt:2304CWP itself may continue listening locally:
0.0.0.0:2304 LISTENThat does not automatically mean it is reachable from the Internet.
The firewall is what determines external reachability.
12. Recommended CWP Configuration
If you do not actively use:
- remote automation requiring the External API
there is little reason to expose:
TCP 2304to the entire Internet.
A much safer architecture is:
Internet
|
X TCP/2304 blocked
|
CWP APIIf the API is genuinely required, restrict access to specific trusted IP addresses rather than:
0.0.0.0/013. Useful Detection Commands
Check port 2304:
csf -g 2304Check CWP API access:
grep -E '"POST /v1/' /usr/local/cwpsrv/logs/2304_access_logCheck suspicious CWP API execution:
grep -nE 'Start backup .*bash -c' /var/log/cwp/cwp_api.logCheck GSocket indicators:
ps auxww | grep -Ei 'gsocket|gs-netcat|id_rsa|kaluad'Check known C2 connections:
ss -plant | grep -E '212.132.98.170|146.103.45.130'Check suspicious files:
ls -l
/usr/bin/id_rsa
/usr/sbin/authd
/usr/sbin/bootcfg
/usr/sbin/firewallctlCheck suspicious systemd references:
grep -RniE
'id_rsa|kaluad|GS_ARGS|gsocket'
/etc/systemd
/usr/lib/systemd
/lib/systemdCheck immutable webroots:
find /home
-mindepth 2
-maxdepth 2
-type d
-name public_html
-exec lsattr -d {} ;Check recent root-owned website files:
find /home
-path '/public_html/'
-type f
-user root
-ctime -14
-ls14. Indicators of Compromise
Indicators found during this incident included:
Attacker / API activity:
146.103.45.130
GSocket C2:
212.132.98.170
Malware SHA256:
d94f75a70b5cabaf786ac57177ed841732e62bdcc9a29e06e5b41d9be567bcfa
Suspicious paths:
/usr/bin/id_rsa
/usr/sbin/authd
/usr/sbin/bootcfg
/usr/sbin/firewallctl
Suspicious service:
id_rsa.service
Masqueraded process:
[kaluad]
Domains observed in root shell activity:
memek.cc
gsocket.io
localroot.sbs
Website indicators:
test123zz
TESTPAGE_1787038851
LAMTOTO
slot777
lamtoto-*.pages.devIndicators should never be treated individually as automatic proof of compromise.
Context matters.
For example, a historical log containing an IOC after cleanup does not mean the malicious process is currently active.
15. Security Audit Script
After the incident I created a read-only audit script that can be deployed across CWP/Linux servers.
The audit checks:
An important design decision was:
The audit detects and reports. It does not automatically delete or repair anything.
Automatic malware removal on a production server can easily destroy legitimate data or forensic evidence.
16. SPF / DKIM / DMARC and Security Reports
Another problem discovered during the investigation was that security audit emails were not arriving in Gmail.
Postfix showed:
550-5.7.26
Unauthenticated email ... not accepted due to domain's DMARC policyThe server's hostname had no suitable SPF record and DKIM was not published.
For the server hostname, an SPF record was added similar to:
v=spf1 ip4:SERVER_IP -allAfter DNS propagation:
dig +short TXT server.example.comshould return the SPF record.
If DMARC is:
v=DMARC1; p=reject;mail authentication must be configured correctly or Gmail may reject automated security reports.
17. Important Lesson About Root Passwords
Changing the root password is important after compromise.
However:
Changing the root password does not fix an unauthenticated remote code execution vulnerability.
If the attacker entered through a public CWP API vulnerability, they never needed the root password.
Therefore the correct order is:
contain vulnerable interface
remove persistence
preserve evidence
rotate credentials
patch/update
rebuild where necessaryPasswords are only one part of the recovery process.
18. Can the Existing Server Be Trusted Again?
This is the most important conclusion.
Once an attacker has obtained unrestricted root access, it is impossible to prove with certainty that every modification has been discovered.
Root can alter:
Removing the known malware is therefore containment, not restoration of trust.
The safest recovery procedure after confirmed root compromise remains:
Preserve important forensic evidence.
Build a fresh server from trusted installation media.
Install an updated operating system and control panel.
Apply all security updates before exposing services.
Restrict CWP/SSH/API management ports.
Restore only verified website data.
Do not restore suspicious system files.
Rotate:
root credentials
SSH keys
CWP credentials
FTP credentials
database passwords
email passwords
API keys
application secrets
Scan restored websites.
Establish a clean security baseline.
Enable continuous monitoring.19. Major Lessons Learned
The biggest lessons from this incident were:
- Do not assume the visible compromised website is the entry point.
The affected Joomla websites were consequences of the compromise, not necessarily the cause.
- Always correlate filesystem timestamps with web/API logs.
This was how the CWP API activity was linked to subsequent server-side actions.
- Control-panel APIs deserve the same protection as SSH.
A privileged API publicly exposed on the Internet can represent a much larger risk than an individual CMS.
- Running administrative PHP as root greatly increases the impact of an application vulnerability.
The CWP cwpsrv PHP-FPM pool was running as root.
- Killing a malware process is not enough.
Systemd restarted the malicious process automatically.
- Check caches after restoring a compromised website.
Nginx may continue serving previously cached malicious content.
- Inspect all hosting accounts after server-level compromise.
The attacker had access across account boundaries.
- Do not rely solely on malware scanners.
Timeline reconstruction, logs, process ancestry, filesystem metadata and network connections were critical.
- Keep management interfaces restricted whenever possible.
If an API is not required publicly, do not expose it publicly.
20. Final Conclusion
What initially appeared to be a Joomla SEO-spam infection turned out to be a complete server compromise.
The key evidence showed:
CWP External API
TCP 2304
POST /v1/backup
root-running cwpsrv PHP-FPM
remote shell execution
GSocket persistence
cross-account website modificationThe incident demonstrates why server administrators should never limit an investigation to the website where the first symptoms appear.
A compromised site can be the victim of a much deeper server-level intrusion.
If you operate CWP servers, I strongly recommend reviewing whether External API port 2304 needs to be exposed at all, auditing /var/log/cwp/cwp_api.log, reviewing privileged PHP-FPM pools, monitoring unexpected root-owned website files and maintaining off-server clean backups.
And most importantly: if root compromise is confirmed, cleaning visible malware should be considered temporary containment — not proof that the server is trustworthy again.
The best possible way to start your online marketing : fspirits.com/go/leadsleap-home
Create Amazing AI Videos : fspirits.com/go/video-express-ai
Start your affiliate journey here: fspirits.com/go/olsp-academy
Edit And Create Videos: fspirits.com/go/create-studio-pro
Best Solution To Create Graphics: fspirits.com/go/artistly
Smart Chat Automation: fspirits.com/go/chatterpal
Multi-Purpose Video Maker: fspirits.com/go/avatar-builder
Multi-Purpose Video Creator: fspirits.com/go/videocreator
AI Human Spokesperson Videos: fspirits.com/go/humanpal
Παρακαλούμε Σύνδεση ή Δημιουργία λογαριασμού για να συμμετάσχετε στη συζήτηση.
- Forum
- Main Forum
- English Section
- Server Security
- CWP Server Root Compromise via External API Port 2304 – Real Incident Analysis
Χρόνος δημιουργίας σελίδας: 0.071 δευτερόλεπτα