By Pablo Artuso, Yvan Genuer iggy [Argentina]

0 17
By Pablo Artuso, Yvan Genuer iggy [Argentina]Chain Attack: New remote and root...

By Pablo Artuso, Yvan Genuer iggy [Argentina]

Chain Attack: New remote and root privilege access vectors found in SAP enterprise software

image-19.png

Stage 3

image-20.png

By Pablo Artuso, Yvan Genuer iggy   [Argentina]

SAP system (Systems, Applications, and Products in Data Processing) is an enterprise management software developed by the German SAP company, widely used by various enterprises for resource planning and management. The SAP system includes a series of integrated modules, each designed to manage different business functions such as finance, human resources, manufacturing, supply chain, and customer relationships.

  • ERP (Enterprise Resource Planning): SAP ERP is the core of the SAP system, providing comprehensive enterprise resource planning functions to help enterprises integrate and manage various business processes.

  • SAP S/4HANA: SAP's latest generation ERP system, based on the in-memory computing technology HANA, providing real-time data processing and analysis capabilities, greatly improving system performance and flexibility.

  • SAP Business Suite: Includes multiple modules such as SAP ERP, SAP CRM (Customer Relationship Management), SAP SCM (Supply Chain Management), SAP SRM (Supplier Relationship Management), etc., to help enterprises comprehensively manage business processes.

  • SAP HANA: A high-performance in-memory database that supports real-time data analysis and processing, widely used in big data analysis, business intelligence (BI), and the Internet of Things (IoT) and other application scenarios.

  • SAP Cloud Platform: Provides a cloud-based development and deployment environment to help enterprises quickly develop and expand applications.

  • SAP Analytics: Provides various data analysis and business intelligence tools to help enterprises gain insights from data and support decision-making.

  • SAP Fiori: A set of user experience design guidelines and tools that provide modern, user-friendly interfaces, enabling users to access and use SAP system functions more easily.

  • SAP Ariba: A cloud-based business network that helps enterprises manage procurement and supply chain processes, optimizing supplier relationships.

image-21.png

The few binary files involved are in the supported applications

image-22.png

The two executable files are a service and are running as a router

image-23.png

And the http service has been opened

image-24.png

image-25.png

Administrators can usually use saphostctrl + binary file name to connect to the SAP control of the system, from which many functions can be called.

In Figure 2, the speaker discovered the existence of a ConfigureOutsideDiscovery method

When trying to provide some parameters, you will get results related to creating the configuration

image-26.png

After capturing data packets on port 1128 with tcpdump, it was found that the request did not undergo authentication

image-27.png

image-28.png

Attempt to perform system command blind injection
CVE-2023-24523

image-30.png

image-29.png

image-31.png

So this part has been completed currently, but it is not absolute, because at least a basic user is needed here to execute the sending request for local privilege escalation

image-32.png

Stage 2

Protocol

(ACP) P4 attribute protocol

image-33.png

P4 is based on the RMI core
The purpose of this protocol is to promote communication between remote objects, and usually each interface in the system will find a P4 port (usually without security verification)
The P4 protocol is located in the SAP Java NetWeaver layer

image-35.png

image-36.png

JNDI represents the Java Naming and Directory Interface (JNDI is a naming service that binds strings to objects), the yellow part is the parser.

In the end, this service can use the returned string to remotely use these objects

  • Service list

image-37.png

Not all services are publicly exposed remotely

CVE-2021-21481: SAP deserialization

https://codewhitesec.blogspot.com/2021/06/about-unsuccessful-quest-for.html

Cycle

image-39.png

Special SAP system

image-40.png

image-43.png

The SPA manager is a subnet with a Java stack, and the manager has P4 services
Therefore, in the entire Jendayi service, there are few services, but there are several that only exist on sub-managers
Fortunately, the communication protocol used by smd proxy is also P4

image-44.png

Interestingly, when the SAP manager initiates a sub-solution request, all smd proxies will accept and process it

image-45.png

image-47.png

Provide a string as the Java class

image-48.png

Start simulation running

image-49.png

image-51.png

image-52.png

The SAP manager can communicate with the sub-manager via P4 protocol and call Java classes through smd proxy

image-53.png

TOP|
--|
SPA system|
SMD proxy|
Vulnerable Java class|

Call the vulnerable Java class through P4 protocol to complete the entire attack

image-54.png

Here, you can perform local privilege escalation in stage 3 through remote command execution (only for Windows) or SSRF

image-55.png

image-56.png

Combined with CVE-2023-24523

Communicates with smd proxy via P4 protocol -> sends payload, proxy triggers SSRF -> HTTP request CVE-2023-24523 local privilege escalation -> reverse shell

image-57.png

Stage 1

SAP JNDI injection: JEA

image-58.png

image-59.png

The key is the redirect function

image-61.png

The URL is used as a parameter to split the prefix and the URL and other parts, and then use the in-memory mapping, where the mapping prefix is used as the key and the object as the value

Therefore, it finds the corresponding object in the mapping based on the prefix and executes the function in the object

image-62.png

Connector

image-63.png

image-64.png

When the prefix is pcd, it will be found that it executes a lookup function

image-65.png

Therefore, you can perform search injection based on the parameters provided by the user

image-66.png

image-67.png

You need to find some lookup function vulnerabilities

image-68.png

The document emphasizes that this vulnerability can be exploited through JNDI references

A JNDI reference is just an object: for example, you can provide a service on my server, and when you perform a lookup search on my server, you can obtain the document. When the system tries to restore the reference, you can point to a Java class (remote or local) to execute.

image-69.png

image-70.png

image-71.png

image-72.png

It is obvious that this vulnerability has been patched since 2016

image-73.png

Pablo Artuso, Yvan Genuer iggy found an article written by Michael Stepankin about loading local class files in Java on the blog

https://www.veracode.com/blog/research/exploiting-jndi-injections-java

image-74.png

image-75.png

The premise for java to load the local class is that the class must exist in the SAP classpath

image-76.png

The function to get object instances, which is the actual function that parses the reference, when performing the search it will analyze the reference

image-77.png

The parameter f can be controlled by the attacker and passed to the function findObjectFactory

image-78.png

Firstly, the attacker controls it to create a class object
Secondly, it creates an instance of the class and forces it to be converted to the ObjectFactory class

image-79.png

From the above, we can see that we must provide a parameter that is a factory class and can be nested into the ObjectFactory class

image-80.png

After the function ends, the value will be returned to the parameter fac, where there may also be functions that can be used to get object instances

image-81.png

The getObjectInstance class will definitely be executed

image-82.png

After certain functions, it calls a function named resolveReference

image-83.png

It extracts the appname controlled by the attacker from the reference, and if the application name is not empty in the judgment statement, it will start the application

image-84.png

JNDI reference -> point to local class (give the name of the application to start) -> parse the reference to start the application

image-85.png

A P4 tunnel app can be opened through this vulnerability

image-86.png

Through this P4 tunnel, send P4 traffic. And exploit the vulnerabilities mentioned above

image-87.png

Stage 1

Target Windows, RCE Permission Elevations:

image-88.png

SSRF Permission Elevations:

image-89.png

Elevated Arbitrary File Read Permissions (used in this instance):

image-90.png

Details of the white paper:

https://i.blackhat.com/BH-US-23/Presentations/US-23-Genuer-chained-to-hit-discovering-new-vectors-to-gain-remote-and-root-access-in-sap-enterprise-software-wp.pdf?_gl=1*wjjryd*_gcl_au*NjAzMzk0OTQ1LjE3MTk2NzcyMTU.*_ga*MTUwNzI2ODQzMi4xNzE5Njc3MjE2*_ga_K4JK67TFYV*MTcxOTgwOTU2NS4zLjAuMTcxOTgwOTU2NS4wLjAuMA..&_ga=2.267295565.213268773.1719809566-1507268432.1719677216

你可能想看:

4.5 Main person in charge reviews the simulation results, sorts out the separated simulation issues, and allows the red and blue teams to improve as soon as possible. The main issues are as follows

5. Collect exercise results The main person in charge reviews the exercise results, sorts out the separated exercise issues, and allows the red and blue sides to improve as soon as possible. The main

Distributed Storage Technology (Part 2): Analysis of the architecture, principles, characteristics, and advantages and disadvantages of wide-column storage and full-text search engines

b) It should have a login failure handling function, and should configure and enable measures such as ending the session, limiting the number of illegal login attempts, and automatically logging out w

Enable and query the private data logs of MacOS unified logging

d) Adopt identification technologies such as passwords, password technologies, biometric technologies, and combinations of two or more to identify users, and at least one identification technology sho

2021-Digital China Innovation Competition-Huifu Cybersecurity Track-Final-Web-hatenum and source code analysis and payload script analysis

In today's rapidly developing digital economy, data has become an important engine driving social progress and enterprise development. From being initially regarded as part of intangible assets to now

b) It should have the login failure handling function, and should configure and enable measures such as ending the session, limiting the number of illegal logins, and automatically exiting when the lo

2. Modify etter uid, gid values & enable iptables port forwarding

最后修改时间:
admin
上一篇 2025年03月27日 18:20
下一篇 2025年03月27日 18:43

评论已关闭