+APP.4.6 SAP ABAP Programming
---+APP.4.6.G1. Lack of Authorisation Checks
---+APP.4.6.G2. Loss of Confidentiality or Integrity of Critical Data
---+APP.4.6.G3. Injection Vulnerabilities
---+APP.4.6.G4. Bypassing Existing SAP Security Mechanisms
---+APP.4.6.A1 Protecting Reports with Authorisation Checks (B)
---+APP.4.6.A2 Formally Correct Evaluation of Authorisation Checks (B)
---+APP.4.6.A3 Authorisation Check Before Starting a Transaction (B)
---+APP.4.6.A4 No Proprietary Authorisation Checks (B)
---+APP.4.6.A5 Drawing Up a Policy for ABAP Development (S)
---+APP.4.6.A6 Complete Execution of Authorisation Checks (S)
---+APP.4.6.A7 Authorisation Check During Input Processing (S)
---+APP.4.6.A8 Protection Against Unauthorised or Manipulative Access to the File System (S)
---+APP.4.6.A9 Authorisation Check in Remote-Enabled Function Modules (S)
---+APP.4.6.A10 Execution of Operating System Commands (S)
---+APP.4.6.A11 Avoiding Planted Malicious Code (S)
---+APP.4.6.A12 Avoiding Generic Module Execution (S)
---+APP.4.6.A13 Avoiding Generic Access to Table Contents (S)
---+APP.4.6.A14 Avoiding Native SQL Statements (S)
---+APP.4.6.A15 Avoiding Data Leaks (S)
---+APP.4.6.A16 No System-Dependent Execution of Functions (S)
---+APP.4.6.A17 No Client-Dependent Execution of Functions (S)
---+APP.4.6.A18 Avoiding Open SQL Injection Vulnerabilities (S)
---+APP.4.6.A19 Protection Against Cross-Site Scripting (S)
---+APP.4.6.A20 No Access to Data from Another Client (S)
---+APP.4.6.A21 Ban on Hidden ABAP Source Code (S)
---+APP.4.6.A22 Use of ABAP Code Analysis Tools (H)

APP.4.6 SAP ABAP Programming

Introduction

In-house or custom software development are often programmed in SAP systems. Such developments enable an organisation to adapt individual business processes or reporting requirements to its needs, for example. It is also possible to create special functions that are not available out-of-the-box.

Custom developments may be programmed by an organisation's in-house developers or by those it commissions. ABAP (Advanced Business Application Programming) is often used for this in the SAP environment.

ABAP is a proprietary, platform-independent programming language from the company SAP. It was developed for programming commercial applications in the SAP environment, and its basic structure bears a slight resemblance to the COBOL language. Its important features are:

  • Integration of an authentication, role, and authorisation concept
  • Use of a proprietary, database-agnostic SQL derivative (Open SQL)
  • Support for communications among different SAP systems
  • Integration of audit options

Objective

This module shows ABAP developers and security testers the relevant technical risks that can result from in-house or custom ABAP development. It also defines requirements that show how ABAP programs can be securely developed and used.

This module requires basic knowledge of ABAP and in-house or custom ABAP development tools.

Scoping and Modelling

Module APP.4.6 SAP ABAP Programming must be applied once to each SAP system that involves in-house or custom development created in the ABAP programming language.

This module supplements the modules CON.8 Software Development, APP.6 General Software and APP.7 Development of Individual Software with specific aspects of developing ABAP programs.

It describes the general risks of the ABAP programming language and is not a complete guide to developing ABAP programs. The module defines requirements that should be met from a security point of view when developing ABAP programs.

As web applications only make up a very small proportion of all ABAP applications in SAP implementations, web vulnerabilities are not the focus of this document.

Useful Resources

The “Best Practice Guidelines for Development – Useful Tips for ABAP Development” published by the German-speaking SAP User Group (DSAG) contains more detailed information on ABAP programming.

Further information and best practices on secure ABAP programming is available in Sichere ABAP-Programmierung [Secure ABAP Programming] by Wiegenstein, Schumacher, Schinzel, and Weidemann, which is published by SAP Press.

1. Ħarsa ġenerali

Titlu Standard
APP.4.6.A1 Protecting Reports with Authorisation Checks (B)

It MUST be ensured that only authorised users can start self-programmed evaluations (reports). Therefore, each report MUST perform explicit authorisation checks appropriate to the context at hand.

APP.4.6.A2 Formally Correct Evaluation of Authorisation Checks (B)

Each authorisation check in code MUST be evaluated by querying the return value SY-SUBRC.

APP.4.6.A3 Authorisation Check Before Starting a Transaction (B)

If developers use the CALL TRANSACTION command, a start authorisation check MUST always be performed before the command is executed.

APP.4.6.A4 No Proprietary Authorisation Checks (B)

Each authorisation check MUST be carried out using the AUTHORITY CHECK command provided for this purpose. Proprietary authorisation checks (e.g. based on user names) MUST NOT be used.

APP.4.6.A5 Drawing Up a Policy for ABAP Development (S)

A policy SHOULD be drawn up for the development of ABAP programs. In addition to naming conventions, the policy SHOULD contain specifications for ABAP elements that may or may not be used. The requirements from this module SHOULD be included in the policy. The policy SHOULD be binding for Developers.

APP.4.6.A6 Complete Execution of Authorisation Checks (S)

During an authorisation check in ABAP code (AUTHORITY-CHECK <OBJECT>), it SHOULD be ensured that all fields are checked for the relevant authorisation object. If individual fields are not actually required, they SHOULD be marked as DUMMY. The reason for the exception SHOULD also be documented in the field.

APP.4.6.A7 Authorisation Check During Input Processing (S)

The function codes and screen elements of ABAP Dynpro applications SHOULD be consistent. If a screen element has been deactivated, an application SHOULD NOT react to the events of this element without adequate authorisation checks. If certain entries in a Dynpro menu are hidden or individual buttons are disabled, the corresponding function codes SHOULD also not be executed.

APP.4.6.A8 Protection Against Unauthorised or Manipulative Access to the File System (S)

If access to files on an SAP server depends on user input, this input SHOULD be validated before access is granted.

APP.4.6.A9 Authorisation Check in Remote-Enabled Function Modules (S)

It SHOULD be ensured that all remote-enabled function modules in program code explicitly check whether the initiator is authorised to execute the corresponding business logic.

APP.4.6.A10 Execution of Operating System Commands (S)

Each call of a permitted operating system command SHOULD be preceded by a corresponding authorisation check (authorisation object S_LOG_COM). User input SHOULD NOT be part of a command. For this reason, operating system calls SHOULD only be executed using standard SAP function modules intended for this purpose.

APP.4.6.A11 Avoiding Planted Malicious Code (S)

The ABAP commands INSERT REPORT and GENERATE SUBROUTINE POOL SHOULD NOT be used.

APP.4.6.A12 Avoiding Generic Module Execution (S)

Transactions, programs, function modules, and methods SHOULD NOT be generically executable. If there are important reasons for a generic execution, where and why this is happening SHOULD be documented in detail. In addition, a whitelist SHOULD be defined that contains all the permitted modules. Before a module is called, the user's input SHOULD be compared against the whitelist.

APP.4.6.A13 Avoiding Generic Access to Table Contents (S)

Table contents SHOULD NOT be read generically. If there are important reasons for doing this, where and why this is happening SHOULD be documented in detail. It SHOULD also be ensured that the dynamic table name is restricted to a controllable list of values.

APP.4.6.A14 Avoiding Native SQL Statements (S)

The ABAP Database Connectivity (ADBC) interface SHOULD NOT be used. User input SHOULD NOT be part of ADBC commands.

APP.4.6.A15 Avoiding Data Leaks (S)

A sufficiently secure authorisation check SHOULD be performed before business-critical data is displayed, transmitted, or exported. Planned (intended) export options SHOULD be documented.

APP.4.6.A16 No System-Dependent Execution of Functions (S)

ABAP programs SHOULD NOT be programmed in a system-dependent manner—that is, so that they can only be executed on a particular SAP system. Should this be absolutely necessary, however, it SHOULD be documented in detail. In addition, the code SHOULD then be checked manually.

APP.4.6.A17 No Client-Dependent Execution of Functions (S)

ABAP programs SHOULD NOT be programmed in a client-dependent manner—that is, so that they can only be executed by a particular client. Should this be absolutely necessary, however, it SHOULD be documented in detail. In addition, further security measures SHOULD then be taken, such as a manual code review or quality assurance on the corresponding client.

APP.4.6.A18 Avoiding Open SQL Injection Vulnerabilities (S)

Dynamic Open SQL SHOULD NOT be used. If database access with dynamic SQL conditions is necessary, user input SHOULD NOT be transferred in the respective query. If this is nevertheless the case, the user input MUST be checked (output encoding).

APP.4.6.A19 Protection Against Cross-Site Scripting (S)

Custom-developed HTML in Business Server Page (BSP) applications or HTTP handlers SHOULD be avoided whenever possible.

APP.4.6.A20 No Access to Data from Another Client (S)

Automatic client separation SHOULD NOT be bypassed. Data from other clients SHOULD NOT be accessed using EXEC SQL or the Open SQL option CLIENT SPECIFIED.

APP.4.6.A21 Ban on Hidden ABAP Source Code (S)

The source code of an ABAP program created in-house SHOULD always be readable. Techniques that prevent this (obfuscation) SHOULD NOT be used.

APP.4.6.A22 Use of ABAP Code Analysis Tools (H)

An ABAP code analysis tool SHOULD be used to automatically check ABAP code for security-relevant programming errors, functional and technical errors, and quality vulnerabilities.

1.1 Referenzi

1.2 Rekwiżiti identifikati

1.3 Regolamenti relatati

2. Rekwiżiti identifikati

Rekwiżiti
Sors Rekwiżit

3. Regolamenti relatati

Regolamenti
Sors Regolamentazzjoni

Kwistjonijiet marbuta