Veeam Backup & Replication Vulnerability Debugging Environment Setup

Onedaysec
4 min read
0 views
docx image 1769397695424 0 7437c9e42e

Veeam Backup & Replication Vulnerability Debugging Environment Setup

0x00 Preface

This article takes CVE-2023-27532 as an example to introduce the setup method of the Veeam Backup & Replication vulnerability debugging environment.

0x01 Introduction

This article will cover the following content:

Environment Setup

Debugging Environment Setup

Database Credential Extraction

Brief Analysis of CVE-2023-27532

0x02 Environment Setup

1. Software Installation

Installation Document: https://helpcenter.veeam.com/archive/backup/110/vsphere/install_vbr.html

Software Download Link: https://www.veeam.com/download-version.html

License Application Link: https://www.veeam.com/smb-vmware-hyper-v-essentials-download.html

Download the ISO file; the License file obtained via email is required during installation.

2. Default Directory

Installation Directory:C:\\Program Files\\Veeam\\

Log Path:C:\\ProgramData\\Veeam\\Backup

3. Default Ports

Veeam.Backup.Service ports: 9392,9401(SSL)

Veeam.Backup.ConfigurationService port: 9380

Veeam.Backup.CatalogDataService port:9393

Veeam.Backup.EnterpriseService port:9394

Web UI ports:9080,9443(SSL)

RESTful API ports:9399,9398(SSL)

0x03 Debug Environment Setup

1. Locate Process

Execute Command:netstat -ano |findstr 9401

Return Result:

【技术原创】Veeam Backup & Replication漏洞调试环境搭建

Located process with pid 7132, process name is Veeam.Backup.Service.exe

Use dnSpy to attach to the process Veeam.Backup.Service.exe

2. Debug Settings

To view variable contents during the Debug process, the following files need to be created:

C:\Program Files\Veeam\Backup and Replication\Backup\Veeam.Backup.Service.ini

C:\Program Files\Veeam\Backup and Replication\Backup\Veeam.Backup.DBManager.ini

C:\Program Files\Veeam\Backup and Replication\Backup\Veeam.Backup.ServiceLib.ini

C:\Program Files\Veeam\Backup and Replication\Backup\Veeam.Backup.Interaction.MountService.ini

Content is:

【技术原创】Veeam Backup & Replication漏洞调试环境搭建0x04 Database Credential Extraction

1. Obtain Database Connection Configuration

(1) Obtain Database Connection Port

Open SQL Server 2016 Configuration Manager, select SQL Server Services, and you can see that the Process ID corresponding to SQL Server (VEEAMSQL2016) is 1756, as shown in the following figure

【技术原创】Veeam Backup & Replication漏洞调试环境搭建Check the port corresponding to the process: netstat -ano|findstr 1756

Return result:

【技术原创】Veeam Backup & Replication漏洞调试环境搭建

Obtain the connection port 49720

(2) Get the database name

Method 1:

Go to Configuration Database Connection Settings, on the page you can see the Database name is VeeamBackup and the authentication method is Windows Authentication, as shown in the following figure

【技术原创】Veeam Backup & Replication漏洞调试环境搭建

Method 2:

Read the registry key value: REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Veeam\Veeam Backup and Replication" /v SqlDatabaseName

2. Database connection

(1) Use a GUI program

Use DbSchema here

Select SqlServer, configure as shown in the following figure

【技术原创】Veeam Backup & Replication漏洞调试环境搭建

Successful connection as shown in the following figure

【技术原创】Veeam Backup & Replication漏洞调试环境搭建

Select the database VeeamBackup.dbo, enter the database page, search for the keyword 'password' globally, and get the relevant query statement:

【技术原创】Veeam Backup & Replication漏洞调试环境搭建After execution, obtain the credential information stored in the database, as shown in the following figure

【技术原创】Veeam Backup & Replication漏洞调试环境搭建

(2) Use Powershell

Reference: https://github.com/sadshade/veeam-creds

When veeam-creds is tested on Veeam Backup and Replication 11 and higher versions, it will report an error with the prompt:

【技术原创】Veeam Backup & Replication漏洞调试环境搭建

This is because sqloledb is used at https://github.com/sadshade/veeam-creds/blob/main/Veeam-Get-Creds.ps1#L32, and the sqloledb on the current system has expired

Here, you can choose to use MSOLEDBSQL or MSOLEDBSQL19 to resolve this issue

PowerShell command to check if MSOLEDBSQL or MSOLEDBSQL19 is installed on the current system: (New-Object System.Data.OleDb.OleDbEnumerator).GetElements() | select SOURCES_NAME, SOURCES_DESCRIPTION

Example of return result:

【技术原创】Veeam Backup & Replication漏洞调试环境搭建

The above result shows that MSOLEDBSQL19 is installed on the current system, so you only need to replace sqloledb with MSOLEDBSQL19

Supplement: Method to install MSOLEDBSQL or MSOLEDBSQL19

Download link: https://learn.microsoft.com/en-us/sql/connect/oledb/download-oledb-driver-for-sql-server?source=recommendations&view=sql-server-ver16

Command line installation method: msiexec /i msoledbsql.msi /qn IACCEPTMSOLEDBSQLLICENSETERMS=YES

Before installation, the minimum required version of Microsoft Visual C++ Redistributable is 14.34

Simple method to check the version of Microsoft Visual C++ Redistributable:

Obtained via folder name: dir /o:-d \"C:\\ProgramData\\Package Cache\"

Example of return result:

【技术原创】Veeam Backup & Replication漏洞调试环境搭建

From this, we can see that the version of Microsoft Visual C++ Redistributable is 14.29.30037, so a higher version of Microsoft Visual C++ Redistributable needs to be installed. Download link: https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170

Both x86 and x64 versions need to be installed. The successful operation of veeam-creds is shown in the following figure

【技术原创】Veeam Backup & Replication漏洞调试环境搭建

0x05 Brief Analysis of CVE-2023-27532

Y4er published a POC for obtaining plaintext credentials by calling CredentialsDbScopeGetAllCreds: https://y4er.com/posts/cve-2023-27532-veeam-backup-replication-leaked-credentials/

1. Credential Location

The location corresponding to the plaintext credentials here is: Veeam Backup & Replication Console -> Manage Credentials. The default plaintext password is empty, as shown in the following figure

【技术原创】Veeam Backup & Replication漏洞调试环境搭建The debug breakpoint location is Veeam.Backup.DBManager.dll -> CCredentialsDbScope, as shown in the following figure

【技术原创】Veeam Backup & Replication漏洞调试环境搭建

2. Data Parsing

The final return result of the POC is serialized XML. After decrypting ParamValue with Base64, plaintext data can be seen, but the format is incorrect and there are garbled characters

Here, you can call Veeam's built-in DLLs to deserialize the data and get the correct format

Code example for formatted output string:

【技术原创】Veeam Backup & Replication漏洞调试环境搭建

Need to reference DLL files:

Veeam.Backup.Common.dll

Veeam.Backup.Configuration.dll

Veeam.Backup.Interaction.MountService.dll

Veeam.Backup.Logging.dll

Veeam.Backup.Model.dll

Veeam.Backup.Serialization.dll

Veeam.TimeMachine.Tool.dll

Compiled files need to be used in a local environment with Veeam installed; otherwise, an error message will be displayed:

【技术原创】Veeam Backup & Replication漏洞调试环境搭建【技术原创】Veeam Backup & Replication漏洞调试环境搭建

An example of the program's successful execution result is shown in the figure below

【技术原创】Veeam Backup & Replication漏洞调试环境搭建0x06 Summary

This article takes CVE-2023-27532 as an example to introduce the relevant issues and solutions for setting up a Veeam Backup & Replication vulnerability debugging environment.

Related Questions & Answers

Which default ports and services are important for debugging Veeam Backup & Replication vulnerabilities?

Key services include Veeam.Backup.Service (ports 9392 and 9401 with SSL), Veeam.Backup.ConfigurationService (9380), and Veeam.Backup.CatalogDataService (9393). The RESTful API uses ports 9399 and 9398, while the Web UI uses 9080 and 9443. For debugging, focus on port 9401 to attach a debugger to the Veeam.Backup.Service.exe process. Understanding these ports helps in identifying attack surfaces as described in the [Veeam Backup & Replication Vulnerability Debugging Environment Setup](/news/veeam-backup-replication-vulnerability-debugging-environment-setup).

Why might the veeam-creds PowerShell script fail on Veeam Backup & Replication 11 and higher, and how can it be fixed?

The script fails because it uses the deprecated sqloledb driver, which is expired on newer systems. To fix, replace sqloledb with a supported driver like MSOLEDBSQL or MSOLEDBSQL19. First, check if the driver is installed using PowerShell's OleDbEnumerator. If not, download and install the appropriate OLEDB driver from Microsoft, which may also require updating Microsoft Visual C++ Redistributable to version 14.34 or later. This workaround is essential for successful credential extraction in the [Veeam Backup & Replication Vulnerability Debugging Environment Setup](/news/veeam-backup-replication-vulnerability-debugging-environment-setup).

What is CVE-2023-27532 and how does it relate to credential exposure in Veeam?

CVE-2023-27532 is a vulnerability that allows leaking plaintext credentials stored in Veeam Backup & Replication. The exploit calls the CredentialsDbScopeGetAllCreds function to retrieve serialized XML data containing encrypted credentials. By using Veeam's built-in DLLs (e.g., Veeam.Backup.Common.dll) to deserialize the data, an attacker can obtain the plaintext credentials. This vulnerability targets the credentials managed in the Veeam console. The [Veeam Backup & Replication Vulnerability Debugging Environment Setup](/news/veeam-backup-replication-vulnerability-debugging-environment-setup) article provides a brief analysis and POC reference.

How can I extract database credentials from Veeam Backup & Replication during vulnerability analysis?

Extract credentials by first obtaining the database connection port from SQL Server Configuration Manager (e.g., for VEEAMSQL2016) and the database name from the configuration page or registry. Then use tools like DbSchema or PowerShell scripts (e.g., veeam-creds, but with updated OLEDB driver like MSOLEDBSQL19) to connect and query the VeeamBackup database for stored credential information. For full details, see the credential extraction section in the [Veeam Backup & Replication Vulnerability Debugging Environment Setup](/news/veeam-backup-replication-vulnerability-debugging-environment-setup) article.

What steps are needed to set up a debugging environment for Veeam Backup & Replication vulnerabilities like CVE-2023-27532?

To set up a debugging environment, first install Veeam Backup & Replication from the official download using the appropriate license. Then locate the Veeam.Backup.Service.exe process (default port 9401) and attach a debugger like dnSpy. Create .ini files for Veeam.Backup.Service.dll, Veeam.Backup.DBManager.dll, and others to allow variable inspection during debugging. This setup is detailed in the [Veeam Backup & Replication Vulnerability Debugging Environment Setup](/news/veeam-backup-replication-vulnerability-debugging-environment-setup) article.

Continue Reading