Skip links
Arpine Maghakyan

Arpine Maghakyan

Security Researcher of RedRays.

BSP Page Directive & , SAP security note 887168

Description

XSS attacks typically happen because of code that has roughly the following format:

<%@page language=”abap”%>
<html><body><form>
  <% data: x type string.
     x = request->get_form_field( ‘x’ ).
  %>
  <input type=text name=x value=”<%=x%>”>
  <input type=submit>
</form></body></html>

What we see here is that input is taken from the incoming HTTP request, not validated by the application, and then directly used in the rendered HTTP response. This allows a XSS attack whereby a HTTP request can be constructed that has also JavaScript inside some formfields, that are then rendered back to the user’s browser, and possibly executed there.

The simplest form of protection is to HTML encode all strings before rendering them.

One solution that is already supported, is that the developer can manually do an HTML encode on all strings.
  <% data: x type string.
     x = request->get_form_field( ‘x’ ).
     x = cl_http_utility=>html_encode( x ).
  %>
To make life easier for the developer, the BSP compiler has always also supported a build-in HTML encoding. This could be achieved by changing the print statement.

  <input type=text name=x value=”<%html=x%>”>

However, this writing form “<%html=…%>” must be used for each and every print statement and not be forgotten.

Note: while adding the feature described below, we observed and fixed a problem with the “<%html=…%>” sequence which would make it fail after the second and subsequent uses on a page. For this problem, Note Assisted corrections are supplied over all releases and service pack.s

Available fix and Supported packages

  • SAP_BASIS | 620 | 640
  • SAP_BASIS | 700 | 700
  • SAP_BASIS | 710 | 710
  • SAP_BASIS 640 | SAPKB64015 |
  • SAP_BASIS 620 | SAPKB62056 |
  • SAP_BASIS 700 | SAPKB70006 |
  • SAP_BASIS 620 | SAPKB62057 |

Affected component

    BC-BSP
    Business Server Pages

CVSS

Score: 0

Exploit

Detailed vulnerability information added to RedRays Security Platform. Contact [email protected] for details.

URL

https://launchpad.support.sap.com/#/notes/887168

TAGS

#

More to explorer

RedRays at Black Hat MEA 2023

🔒 “FROM ON-PREMISES TO CLOUD: A COMPREHENSIVE ANALYSIS OF SAP SECURITY ISSUES” 🔒 📅 17:40, Wed, Nov 15📍 Briefing Stage 4 At

SAP Security For All

RedRays Security Platform for Penetration testers and Bug hunters

The product package is specifically created for cyber security experts who have encountered SAP while participating in bug bounty programs.

RedRays Security Platform for SAP Consultants

The product package is designed for SAP consultants conducting security assessments of SAP ERP systems. We provide essential tools and resources to help professionals in this field conduct their work effectively.

RedRays Security Platform for Enterprises

The product package is specifically optimized to cater to the needs of both small/medium and large companies who are seeking to streamline the process of organizing a comprehensive security system for ERP systems.