Skip to content

Commit 27ee590

Browse files
authored
add updates from contributions (#30)
2 parents ef1d56b + 2a8295c commit 27ee590

File tree

5 files changed

+44
-11
lines changed

5 files changed

+44
-11
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Contribution Process:
4141
- Marc Eisenhardt ([@etk39372](https://github.com/etk39372))
4242
- Frederik Weidemann ()
4343
- DaCodah ([@DaCodah](https://github.com/DaCodah))
44+
- Joris van de Vis ([@kloris](https://github.com/kloris))
4445

4546
## Supporters & Sponsors
4647
Thank you to all our supporters and sponsors for their help and support to allow us to continue our work on the project.

content/Getting_Started/supporter_and_contributors.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ weight: 4
1010
- Marc Eisenhardt ([@etk39372](https://github.com/etk39372))
1111
- Frederik Weidemann ()
1212
- DaCodah ([@DaCodah](https://github.com/DaCodah))
13+
- Joris van de Vis ([@kloris](https://github.com/kloris))
1314

1415
# Supporters
1516
Thank you to all our supporters and sponsors for their help and support to allow us to continue our work on the project.

content/SAP_ABAP_Platform/known_attack_vectors/accessing_filesystem-read.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ This process can lead to access to sensitive files covering both business and se
1515
- `C13Z_FILE_DOWNLOAD_ASCII`
1616
- `C13Z_FILE_DOWNLOAD_BINARY`
1717
- OS Commands (Transaction SM49/SM69, custom code, ABAP code `CALL SYSTEM`, RFC Gateway vulnerability, Report `RSBDCOS0`, etc via `cat`,`ls`, `Get-FileContent`, ... commands)
18+
- ICM misconfiguration via parameter `icm/HTTP/file_access_<nr>` allows to create an alias from which you browse the entire filesystem via a URL. Authentication can be setup via profile parameter `icm/HTTP/auth_<nr>`.
1819

1920

2021
# Mitigation
@@ -23,5 +24,8 @@ This process can lead to access to sensitive files covering both business and se
2324
- Control and maintain `SPTH`
2425
- OS Commands: Requires different mitigation approach through authorization object for `S_LOG_COM` and `S_C_FUNCT`
2526
- Best practices for OS User Security from SAP
27+
- Setup authentication for ICM if needed (`icm/HTTP/auth_<nr>`)
2628

2729
# References
30+
- [SAP Help docs for `icm/HTTP/auth_<nr>`](https://help.sap.com/docs/ABAP_PLATFORM_NEW/bd78479f4da741a59f5e2a418bd37908/483edf38c10272d2e10000000a42189c.html)
31+
- [SAP Help docs for `icm/HTTP/file_access_<nr>`](https://help.sap.com/docs/ABAP_PLATFORM_NEW/683d6a1797a34730a6e005d1e8de6f22/483e1b4e252f72d0e10000000a42189c.html)

content/SAP_ABAP_Platform/known_attack_vectors/os_command_execution.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,19 @@ title: "OS Command execution"
33
---
44

55
# Description
6-
There are various ways to execute os commands via ABAP. When OS commands are executed, `S_LOG_COM` or `S_C_FUNCT` is being checked, depending on the function used to execute OS commands. The execution itself is done through the ABAP kernel and using the OS level authorizations of the user `<SID>adm` or `SAPService<SID>` (Windows).
6+
There are various ways to execute os commands via ABAP. When OS commands are executed, `S_LOG_COM` or `S_C_FUNCT` is being checked in some of the below cases, depending on the function used to execute OS commands. The execution itself is done through the ABAP kernel and using the OS level authorizations of the user `<SID>adm` or `SAPService<SID>` (Windows).
77

88

99
# Risk
10-
If an attacker can execute OS commands he elevates his privileges effective to `<SID>adm` or `SAPService<SID>` (Windows) on OS level. Depending on the OS command and technique used, the limitation may exists to restrict the access to single OS commands.
11-
If an attacker can execute arbitrary OS commands, then this leads to a full compromise of the system.
10+
If an attacker can execute arbitrary OS commands, then this leads to a full compromise of the system because of a.o. the implicit trust relation between the OS user and the Database. This effectively means you can go from the OS user to the Database without providing a password. In SAP Hana DB for example you can use the `hdbsql` executable on the OS with the `-U DEFAULT` flag to execute SQL queries (insert, update, select, etc) directly in the SAP Schema without having to provide any additonal authentication details.
1211

1312
Examples:
14-
- Exfitrate private SSH keys
15-
- Overwrite SAP kernel binaries
13+
- Exfiltrate private SSH keys
14+
- Overwrite SAP kernel binaries or ACL files
1615
- Inject code into custom scripts
16+
- Extract the secure store
17+
- Via the DB trust relation extract password hashes, create SAP users with SAP_ALL directly in the DB
18+
- Delete log/trace files
1719

1820
In certain cases user input filtering can be bypassed and in those cases the attack can lead to a full compromise of the system. If the execution is limited to a single command, then the business impact depends on the command or the allowed user input of e.g. the parameter.
1921

@@ -29,6 +31,19 @@ In certain cases user input filtering can be bypassed and in those cases the att
2931
- Custom Code/ Third Party Code (ABAP `CALL 'SYSTEM'`)
3032
- Vulnerable Components (e.g. SAP RFC Gateway)
3133
- Schedule Background Jobs as user `DDIC`
34+
- Instance profile (executed upon (re)starting SAP): `Execute_XX = <your_command_to_execute_here>` (XX = number like 01)
35+
- SAP Kernel call from ABAP coding:
36+
```abap
37+
CALL 'ThWpInfo' ID 'OPCODE' FIELD (Linux only)
38+
REPORT ZTEST.
39+
DATA OPCODEXEC TYPE X VALUE 9.
40+
CALL 'ThWpInfo' ID 'OPCODE' FIELD OPCODEXEC
41+
ID 'SERVER' FIELD ''
42+
ID 'PROG' FIELD 'mkdir '
43+
ID 'ARGC' FIELD 1
44+
ID 'ARG1' FIELD '/tmp/blablabla'.
45+
WAIT UP TO '0.9' SECONDS.
46+
```
3247

3348
# Mitigation
3449
- Requires different mitigation approach through authorization object for `S_LOG_COM` and `S_C_FUNCT`

content/SAP_ABAP_Platform/known_attack_vectors/password_hashes.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@ These Tables are:
1313
- VUSER001
1414
- VUSR02_PWD
1515
- USR_TOTP
16+
- EDIDC (Idocs from CUA)
1617

1718
There are various ways to access the content of those tables with the consequence of disclosing the hashes. SAP development implemented different hash algorithms throughout the years. The below list shows a breif overview of the used algorithms, starting from the weakest first:
1819

19-
-BCODE -> outdated an highly insecure
20-
-PASSCODE -> outdated and insecure
21-
-PWDSALTEDHASH -> currently recommended version
20+
Algorithm | comment
21+
----------|---------
22+
BCODE | outdated an highly insecure
23+
PASSCODE | outdated and insecure
24+
PWDSALTEDHASH | currently recommended version
2225

2326
A detailed explanation is available [here](https://www.daniel-berlin.de/security/sap-sec/password-hash-algorithms/).
2427

@@ -29,9 +32,15 @@ Older SAP password hash algorithms (such as those based on weak cryptographic fu
2932

3033
# Options
3134
- Extraction of hashes using Transaction (SE16, SE16N, DBA_COCKPIT, etc)
32-
- Extraction of hashes via OS Command (special case, access underlying database and tables mentioned above (SQL-Query with Select statement) -> should refer to HDBSQL / SQL-Access OS Command <Option>
33-
- Cracking hashes (Hashcat, John the Ripper)
34-
35+
- Extraction of hashes via OS Command (special case, access underlying database and tables mentioned above (SQL-Query with Select statement) ([more information here](/SAP_ABAP_Platform/known_attack_vectors/os_command_execution/#))
36+
- Cracking hashes (e.g. with Hashcat, John the Ripper)
37+
- Supported hashtypes from Hashcat (by 26th September 2025):
38+
- SAP CODVN B (BCODE)
39+
- SAP CODVN B (BCODE) from RFC_READ_TABLE
40+
- SAP CODVN F/G (PASSCODE)
41+
- SAP CODVN F/G (PASSCODE) from RFC_READ_TABLE
42+
- SAP CODVN H (PWDSALTEDHASH) iSSHA-1
43+
- SAP CODVN H (PWDSALTEDHASH) isSHA512
3544

3645
# Mitigation
3746
- Use at least PWDSALTEDHASH for all your current hashes
@@ -52,3 +61,6 @@ Older SAP password hash algorithms (such as those based on weak cryptographic fu
5261
- [In depth analysis - Password Hash Algorithms](https://www.daniel-berlin.de/security/sap-sec/password-hash-algorithms/)
5362
- [Report ZCLEANUP_PASSWORD_HASH_VALUESX - Remove weak password hash values](https://community.sap.com/t5/application-development-and-automation-blog-posts/report-zcleanup-password-hash-valuesx-remove-weak-password-hash-values/ba-p/13525553)
5463
- [Protect read access to password hash value tables](https://me.sap.com/notes/1484692/)
64+
- [SAP IDOC Hash Harvester](https://github.com/kloris)
65+
- [Hashcat pasword bruteforcer](https://hashcat.net/hashcat/)
66+
- [John the Ripper](https://www.openwall.com/john/)

0 commit comments

Comments
 (0)