Official Content
  • This documentation is valid for:

Here we will describe some guidelines to take into account to check the security of our GeneXus application following the OWASP 2013 Top 10 Security Risks.
This document does not pretend to be a complete guide of what a GeneXus developer should do to check the security of his applications. It only enumerates those points related with GeneXus itself (the tool) and when programming using GeneXus that needs to be evaluated to check application security. It is recommended to use this guide as part of some more detailed and complete company or application specific security check guidelines.

Actions

We identify three types of actions that can be made to handle a security risk in a GeneXus application:

  1. GeneXus actions. Those actions that GeneXus take by itself when generating the application (i.e. encode all information sent by the server).
  2. User actions when programming in GeneXus. These actions are those that the GeneXus developer should take into account when developing using GeneXus (i.e. avoid using some command or function).
  3. User actions outside GeneXus. These are actions that are the responsibility of the developer but regarding non-GeneXus factors (i.e. server configurations).

Security Scanner extension

Security Scanner is a GeneXus extension created to help GeneXus developers to detect those possible security risks that are caused by GeneXus programming. This kind of risks requires an action of the type number 2 listed before. Security Scanner just detects and sends a warning to the user that something could be a security problem. The user has to check the case and confirm if it is a real security risk or not. The tool can be download from here and the user manual can be found here.

OWASP 2013 Top 10

Following is a list of the OWASP 2013 Top 10 Security Risks and how can they be treated when developing an application in GeneXus. Also, it is marked those point that can be detected using Security Scanner extension.

A1-Injection

Description:
Injection flaws, such as SQL, OS, and LDAP injection occur when untrusted data is sent to an interpreter as part of a command or query. The attacker’s hostile data can trick the interpreter into executing unintended commands or accessing unauthorized data.

Actions:

By GeneXus:

By User:

  • Avoid using SQL command (Security Scanner #103).
  • Check the usage of the Shell function (Security Scanner #114).
  • Minimize the use of the Form.HeaderRawHTML (Security Scanner #117) and Form.JScriptSrc properties (Security Scanner #118).
  • Check the commands used to include native code (Security Scanner #108).
  • Check User Controls (Security Scanner #121) and External Objects (Security Scanner #120) usage.
  • Check the HttpResponse data type usage (Security Scanner #109).
  • Check the LDAPClient Data Type GetAttribute method usage (Security Scanner #110).
  • When using the XMLReader Data Type use the ValidationType property (Security Scanner #113).
  • When using the XMLWriter Data Type WriteRawText method property (Security Scanner #125).
  • Check the usage of the ToXML, ToJSon methods when using SDTs, in particular when setting data within the WebSession or WebService usage (Security Scanner partial detection #122 and #123).

A2-Broken Authentication and Session Management

Description:
Application functions related to authentication and session management are often not implemented correctly, allowing attackers to compromise passwords, keys, session tokens, or exploit other implementation flaws to assume other users’ identities.

Actions:

By GeneXus:
Consider using the built in GeneXus Access Manager Security Module.


By User:

A3-Cross Site Scripting (XSS)

Description:
XSS flaws occur whenever an application takes untrusted data and sends it to a web browser without proper validation or escaping. XSS allows attackers to execute scripts in the victim’s browser which can hijack user sessions, deface web sites, or redirect the user to malicious sites.

Actions:

By GeneXus:

  • Encoding of all information sent between the server and client.

By User:

A4-Insecure Direct Object References

Description:
A direct object reference occurs when a developer exposes a reference to an internal implementation object, such as a file, directory, or database key. Without an access control check or other protection, attackers can manipulate these references to access unauthorized data.

Actions:

By GeneXus:
Does not applies

By User:

  • Encrypt parameters (Security Scanner #100).
  • Use GAM (from Evolution 2, Security Scanner).
  • Check Directory (Security Scanner #111) and File (Security Scanner #112) data type usage.
  • Check User Controls (Security Scanner #121) and External Objects (Security Scanner #120) usage.
  • Do not expose the location.xml and PrivateTempStorage folders (SAC # 35044)

A5-Security Misconfiguration

Description:
Good security requires having a secure configuration defined and deployed for the application, frameworks, application server, web server, database server, and platform. All these settings should be defined, implemented, and maintained as many are not shipped with secure defaults. This includes keeping all software up to date.

Actions:

By GeneXus:

By User:

  • Security protocol (Security Scanner can check GeneXus property Protocol Specification, but it does not mean that the server is using HTTPS).
  • Updated platform and verificable configuration.
  • Delete unnecessary and debug access points (backdoors).
  • Check the SetCookie function and Cookie data type usage (Security Scanner #116 and #124).

A6-Sensitive Data Exposure

Description:
Many web applications do not properly protect sensitive data, such as credit cards, tax ids, and authentication credentials. Attackers may steal or modify such weakly protected data to conduct identity theft, credit card fraud, or other crimes. Sensitive data deserves extra protection such as encryption at rest or in transit, as well as special precautions when exchanged with the browser.

Actions:

By GeneXus:

  • Default encryption keys (more info in SAC #29369.

By User:

  • Modify encryption keys, using application.key file (more info in SAC #29369) or a customized assembly (only C#, more info in SAC #29874).
  • Check the SetCookie function and Cookie data type usage (Security Scanner #116 and #124).
  • Check Random function usage (Security Scanner #115).
  • Check GeneXus code associated to fields where a password is set. The Security Scanner (#119) can check for the GeneXus "IsPassword" control property, but business logic must be checked manually.
  • Verify certificates and key protection.

A7-Missing Function Level Access Control

Description:
Virtually all web applications verify function level access rights before making that functionality visible in the UI. However, applications need to perform the same access control checks on the server when each function is accessed. If requests are not verified, attackers will be able to forge requests in order to access unauthorized functionality.

Actions:

By GeneXus:

  • All validations are server-side generated.

By User:

  • Have an authentication and authorization method (Security Scanner #102).
  • Use GAM (from Evolution 2, Security Scanner).
  • Check web components URL Access property (Security Scanner #107).
  • Check LDAPClient Data Type GetAttribute method usage (Security Scanner #110).

A8-Cross Site Request Forgery (CSRF)

Description:
A CSRF attack forces a logged-on victim’s browser to send a forged HTTP request, including the victim’s session cookie and any other automatically included authentication information, to a vulnerable web application. This allows the attacker to force the victim’s browser to generate requests the vulnerable application thinks are legitimate requests from the victim.

Actions:

By GeneXus:
Does not applies

By User:

  • Encrypt parameters (Security Scanner #100).
  • Avoid using “HTML” or “Raw HTML” in the Format property of Form controls (Security Scanner #101).
  • Avoid using dynamic Link commands without parameters (Security Scanner #104).

A9-Using Components with Known Vulnerabilities

Description:
Vulnerable components, such as libraries, frameworks, and other software modules almost always run with full privilege. So, if exploited, they can cause serious data loss or server takeover. Applications using these vulnerable components may undermine their defenses and enable a range of possible attacks and impacts.

Actions:

By GeneXus:

  • All the application source code generated is available for review; it includes the GeneXus Standard Classes and External utilities used. In general, the external utilities are used within the generated code, as these components are not directly accessible by application users it makes it harder to exploit vulnerabilities found.

By User:

  • Security protocol (Security Scanner can check GeneXus property Protocol Specification, but it does not mean that the server is using HTTPS).
  • Updated platform and verificable configuration.
  • Delete unnecessary and debug access points (backdoors).
  • Check the SetCookie function and Cookie data type usage (Security Scanner #116 and #124).
  • Check User Controls (Security Scanner #121) and External Objects (Security Scanner #120) usage.
  • Ensure that you keep your GeneXus version and associated infraestructure up-to-date.

A10-Unvalidated Redirects and Forwards

Description:
Web applications frequently redirect and forward users to other pages and websites, and use untrusted data to determine the destination pages. Without proper validation, attackers can redirect victims to phishing or malware sites, or use forwards to access unauthorized pages.

Actions:

By GeneXus:
Does not applies

By User:

  • Avoid using dynamic Link commands without parameters (Security Scanner #104).

Considerations

When using the GAM Security Module, make sure to review this checklist.

See also

GAM
Going into production: checklist for Applications which use GAM
GeneXus Standard Classes


Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant