Skip links

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

#

How to detect over 4100 vulnerabilities in SAP Systems?

More to explorer

Initiating SAP Penetration Testing

►   Pentest, short for penetration testing, refers to a set of processes that simulate an attacker’s actions to identify security vulnerabilities. Companies

SAP Security Patch Day RedRays

May 2024 SAP Security Patch Day

Vulnerability: Multiple vulnerabilities in SAP CX Commerce SAP Component: CEC-SCC-PLA-PL CVE ID: CVE-2019-17495 CVSS Score: 9.8 CVSS Vector: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H Category: Program error