RFC Hacking: How to Hack an SAP System in 3 Minutes

The RFC hacking demonstration shows three exploits: running operating system commands through the RFC gateway to extract credentials, turning system users into dialog users for remote logons, and an RFC callback attack that creates an unauthorized SAP_ALL user. SAP Solution Manager can discover systems vulnerable to these exploits.

Executive Summary

RFC exploits are hardly new, and some of the well-known exploits demonstrated in the video are addressed by SAP Notes dating back several years. However, the measures required to harden SAP systems against such exploits are not universally applied, so many installations continue to be vulnerable to relatively simple exploits that could lead to devastating consequences. The demonstrated impact includes the theft of usernames and password hashes, remote logons from trusted systems, and the creation of dialog users with SAP_ALL privileges. The first exploit runs operating system commands through external programs such as sapxpg, called through the RFC gateway without any authentication. The second abuses the RFC protocol to change system users to dialog users and log on remotely. The final exploit is an RFC callback attack that creates an unauthorized user with the SAP_ALL profile in the calling system. Systems vulnerable to RFC exploits can be discovered using SAP Solution Manager, which regularly scans and alerts for vulnerabilities in RFC communications.

Key Takeaways

  • Some well-known RFC exploits are addressed by SAP Notes dating back several years, but the hardening measures are not universally applied.
  • The demonstrated impact includes stolen usernames and password hashes, remote logons from trusted systems, and dialog users with SAP_ALL privileges.
  • Attackers can run operating system commands through external programs such as sapxpg, called through the RFC gateway without any authentication.
  • An RFC callback from a compromised system to a vulnerable system creates an unauthorized user with the SAP_ALL profile in the calling system.
  • SAP Solution Manager scans and alerts for RFC vulnerabilities, and its Monitoring and Alerting Infrastructure (MAI) alerts on RFC destination changes and callbacks.

Why are RFC exploits still a risk for SAP systems?

RFC exploits are hardly new, but the measures required to harden SAP systems against them are not universally applied. As a result, many installations continue to be vulnerable to relatively simple exploits that could lead to devastating consequences in SAP systems. Some of the well-known exploits demonstrated below are addressed by SAP Notes dating back several years. The impact of the exploits in the demonstration below include the theft of usernames and password hashes, remote logons from trusted systems, and the creation of dialog users with SAP_ALL privileges.

How do attackers use the RFC gateway to extract data from an SAP database?

The first exploit demonstrates how attackers can perform operating system commands to extract sensitive information from an SAP database. This is performed through external programs such as sapxpg that are called through the RFC gateway without any authentication. The information extracted in the demo includes user credentials. However, the exploit can be used to read or modify any data from SAP databases.

How do attackers abuse the RFC protocol to log on remotely?

The second exploit demonstrates how attackers abuse the RFC protocol to change system users to dialog users and then logon from remote systems using the privileges of RFC users.

What is an RFC callback attack?

In the example below, an RFC callback from a compromised system to a vulnerable system creates an unauthorized user in the calling system with the dangerous SAP_ALL profile. The final exploit demonstrates the dangers of RFC callback attacks. Attackers can also use this exploit to change salary information, modify programs, and many other scenarios.

How can SAP Solution Manager find RFC vulnerabilities?

Systems vulnerable to RFC exploits can be discovered using SAP Solution Manager. Solution Manager regularly scans and alerts for vulnerabilities in RFC communications such as weaknesses in access control lists for RFC gateways, RFC users with administrative profiles, RFC destinations with stored logon credentials, and missing whitelists for RFC callbacks. The Monitoring and Alerting Infrastructure (MAI) of Solution Manager generates alerts for changes to RFC destinations, successful or unsuccessful attempts to call external programs through the gateway server, and RFC callbacks. Contact Layer Seven Security to discuss how to leverage Solution Manager to discover and remove RFC vulnerabilities in your SAP systems.

SAP RFC Hacking from Layer Seven Security on Vimeo.

Frequently Asked Questions

What is RFC hacking in SAP systems?
RFC hacking, as demonstrated in the Layer Seven Security video, uses RFC exploits against SAP systems that lack the required hardening measures. The demonstrated impact includes the theft of usernames and password hashes, remote logons from trusted systems, and the creation of dialog users with SAP_ALL privileges.

How does the first RFC exploit extract data from an SAP database?
The first RFC exploit performs operating system commands to extract sensitive information from an SAP database. It uses external programs such as sapxpg that are called through the RFC gateway without any authentication. The demo extracts user credentials, but the exploit can be used to read or modify any data from SAP databases.

How does the second RFC exploit allow remote logons?
The second RFC exploit abuses the RFC protocol to change system users to dialog users. Attackers can then logon from remote systems using the privileges of RFC users. Layer Seven Security’s RFC hacking demonstration lists remote logons from trusted systems among the impacts of the RFC exploits it shows in SAP systems.

What does an RFC callback attack do to an SAP system?
In the RFC callback attack demonstrated, an RFC callback from a compromised system to a vulnerable system creates an unauthorized user in the calling system with the dangerous SAP_ALL profile. Attackers can also use this exploit to change salary information, modify programs, and many other scenarios.

Which RFC vulnerabilities does SAP Solution Manager scan for?
SAP Solution Manager regularly scans and alerts for vulnerabilities in RFC communications. These include weaknesses in access control lists for RFC gateways, RFC users with administrative profiles, RFC destinations with stored logon credentials, and missing whitelists for RFC callbacks.

Which RFC events does the Monitoring and Alerting Infrastructure of SAP Solution Manager alert on?
The Monitoring and Alerting Infrastructure (MAI) of SAP Solution Manager generates alerts for changes to RFC destinations, successful or unsuccessful attempts to call external programs through the gateway server, and RFC callbacks. Layer Seven Security invites readers to make contact to discuss using Solution Manager to discover and remove RFC vulnerabilities.

Share the Post: