Skip to content

Add FastAdmin Path Traversal Module (CVE-2024-7928) #20045

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Kazgangap
Copy link

📌 Add FastAdmin Path Traversal Auxiliary Module (CVE-2024-7928)

Description

This PR adds an auxiliary scanner module for a path traversal vulnerability in FastAdmin (versions ≤ 1.3.3.20220121).
The issue exists in the /index/ajax/lang endpoint, where the lang parameter can be manipulated to access arbitrary files on the server. This allows unauthenticated attackers to retrieve sensitive configuration files, including database credentials.

Vulnerability Details

Verification Steps

  1. Deploy a vulnerable version of FastAdmin or identify targets using tools like FOFA/Shodan.
  2. Start msfconsole.
  3. Load the module:
    use auxiliary/scanner/http/fastadmin_path_traversal_cve_2024_7928
    
  4. Set the RHOSTS and RPORT options:
    set RHOSTS <target_ip>
    set RPORT 80
    
  5. Run the module:
    run
    
  6. If the target is vulnerable, database configuration details will be printed.

Output Example

[+] 192.0.2.10 is vulnerable!
[+] DB Type   : mysql
[+] Hostname  : <redacted>
[+] Database  : fastadmin
[+] Username  : root
[+] Password  : <redacted>

Notes

  • The module parses the JSONP response and extracts DB credentials.
  • Results are saved with report_note for later usage.

Let me know if you'd like me to squash commits or reformat anything.
Thanks for reviewing my first contribution to the Metasploit Framework 🙌

@Kazgangap Kazgangap changed the title Fastadmin Add FastAdmin Path Traversal Module (CVE-2024-7928) Apr 17, 2025
@msutovsky-r7 msutovsky-r7 self-assigned this Apr 17, 2025
Copy link
Contributor

@msutovsky-r7 msutovsky-r7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Kazgangap, thanks for your contribution! I have left some comments for you about the code. Also, while the getting sensitive information from one file looks like good start, it seems like this vulnerability can be exploited to read arbitrary file if I'm not mistaken. Therefore, I think it makes more sense to modify this into arbitrary file read module. Let me know if you would need any help or if you would have any comments/notes.

'ssl' => datastore['SSL']
})

unless res && res.code == 200 && res.body.include?('jsonpReturn(')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
unless res && res.code == 200 && res.body.include?('jsonpReturn(')
unless res&.code == 200 && res.body.include?('jsonpReturn(')

return
end

unless data['username'] && data['password'] && data['database']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
unless data['username'] && data['password'] && data['database']
unless data.dig('username') && data.dig('password') && data.dig('database')

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind adding some steps to set up the target?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please rubocop this file?

res = send_request_cgi({
'uri' => url,
'method' => 'GET',
'ssl' => datastore['SSL']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is necessary

))

register_options([
Opt::RPORT(80),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably don't have to register port 80, as it should be default.

@Kazgangap
Copy link
Author

Hi @msutovsky-r7 thanks for the review and feedback!

This is indeed a path traversal vulnerability, but from my testing it seems to be somewhat limited — I wasn't able to read files like /etc/passwd, for example. It looks like access might be restricted to certain application directories.

The original PoCs and the Python script I found also focused on reading the application/database file, which is what I based the module on. That file contains sensitive database credentials, so I thought it was still a useful target.

I’ve also included setup instructions in the module description to help with reproduction. For testing, I found targets using Fofa and confirmed the exploit works in real scenarios.

@Kazgangap Kazgangap requested a review from msutovsky-r7 April 25, 2025 10:03
@msutovsky-r7 msutovsky-r7 removed their assignment Apr 25, 2025
@dledda-r7 dledda-r7 self-assigned this Apr 28, 2025
```bash
git clone https://github.com/fastadminnet/fastadmin.git
cd fastadmin
git checkout 1.3.3.20220121
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
git checkout 1.3.3.20220121
git checkout v1.3.3.20220121


7. **Import the Database Schema**
```bash
mysql -u root -p fastadmin < fastadmin.sql
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
mysql -u root -p fastadmin < fastadmin.sql
mysql -u <username> -p fastadmin < ./application/admin/command/Install/fastadmin.sql

```bash
mysql -u root -p fastadmin < fastadmin.sql
```

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am having some issues finalizing the setup, looks like after following all the steps, i get blank. I saw there is a composer.json file, shouldn't I do something like composer install to get the package dependencies?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am having some issues finalizing the setup, looks like after following all the steps, i get blank. I saw there is a composer.json file, shouldn't I do something like composer install to get the package dependencies?

Hi @dledda-r7 Sorry for the late response to your message. Honestly, I was referring to the standard setup of the application—I haven't installed it myself. I tested it on assets found among approximately 300,000 results in FOFA. It wouldn't be ethical to directly share vulnerable assets, but you can find assets to test by searching for keywords like fastadmin or using queries such as icon_hash="-1036943727" on FOFA.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @Kazgangap, in order to land the module, we need to have valid setup documented with clear steps to install the application in a vulnerable state. Moreover, launching exploits and/or metasploit modules on 3rd-part vulnerable systems is not something we can do to verify the functionality of a pull request. Please take your time on documeting the application setup to be vulnerable and update the docs accordingly.
Thanks for your understanding.

@dledda-r7 dledda-r7 moved this from Todo to Waiting on Contributor in Metasploit Kanban Apr 30, 2025
@Kazgangap Kazgangap requested a review from dledda-r7 May 5, 2025 18:49
@dledda-r7 dledda-r7 added needs-docs blocked Blocked by one or more additional tasks and removed docs labels May 19, 2025
Copy link

Thanks for your pull request! Before this can be merged, we need the following documentation for your module:

@dledda-r7 dledda-r7 removed their assignment May 22, 2025
@jheysel-r7 jheysel-r7 self-assigned this May 22, 2025
@jheysel-r7
Copy link
Contributor

Hey @Kazgangap I was able to install the application successfully with a few extra steps.

  • Setup a site-available, enable it, restart apache2
  • edit composer.json to not reach out to the "gitee" as it requires credentials and doesn't seem necessary - it can be removed
  • install php7.4-bcmath for the version of php being used in the application and enable it with sudo phpenmod bcmath
  • run compose install (ensure it has permissions to create /var/www/html/vendor)

Can you see if these work for you as well, and if so, add them to the documentation? Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Blocked by one or more additional tasks module needs-docs
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

5 participants