Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/363266925

API Case Study

Technical Report · September 2022

CITATIONS READS

0 155

1 author:

Torben Jackisch

6 PUBLICATIONS 0 CITATIONS

SEE PROFILE

All content following this page was uploaded by Torben Jackisch on 04 September 2022.

The user has requested enhancement of the downloaded file.


Assignment 2: API Case Study
Jackisch, Torben
Glyndŵr University
Wrexham, Wales
s20004419@mail.ac.uk

Abstract—This report deals with the development of a web See figure 1 for an illustration of LTCCs communication
API for a fashion company with a focus on the points of model between the internal systems and the applications of
authentication, authorisation, requests, encryption, which API distributors and suppliers.
type is suitable and its testing. In order to answer the
individual questions, various sources were consulted, which II. ASSUMPTIONS
primarily deal with the points of architecture, security and
As the API acts as a gateway to LTCCs internal systems,
communication in the area of APIs. These are, on the one hand,
various scientific studies and, on the other hand, technical
it should be seen as a highly critical implementation of the
documentation on corresponding standards. The most infrastructure.
important results of the work are that certain patterns emerge Authentication service attacks can happen on different
that can be found in many sources. This is especially true with layers. It could be possible to read user and password
regard to architecture and security. Above all, the results information while the communications between the hosts
indicate that a clear solution is possible for the fashion
during a session. The authentication service can also be
company and that a functioning and relatively secure solution
misused for attacks like XSS and execution of other
can be realised with the appropriate standards.
malicious code [1 p3]. Another common threat is an API
Keywords—API, security, authorisation, authentication, exhaustion attack which is a type of denial of service (DOS).
encryption That DOS attack will prevent the system from processing
legitimate requests [1 p4].
I. SCENARIO To prevent threats like the described ones, different
The scenario describes the requirements for an security measures on different layers are necessary, which
application programming interface (API) for the LATEST will be discussed in this paper.
TRENDS CLOTHING COMPANY (LTCC) with a focus on
threats and prevention with security measures for the III. AUTHENTICATION
different stages of communication between the involved Before an authorisation can be granted, the application
systems. The API shall provide different functionality, such user need to authenticate at the API authorisation server with
as manage current stock levels, generate orders and send given username and password and proves his/her identity to
them to suppliers, receive bulk orders from distributors and allow the API to communicate with the application [12].
receive individual orders from distributors customers LTCCs internal user management can use an LDAP solution
(including customer delivery details). The API will handle like OpenLDAP [7] for the authentication of outside users.
the communication between LTCCs internal systems and the The communication need to be secured by SSL/TLS [11] and
applications (or client, but in this paper it is only called a strong password protection [8 p5]. An additional protection
application) of distributors and suppliers. can be the usage of a public key infrastructure using a
common x.509 standard [9] (e.g. RSA, FCC, etc.) [8 p5].
IV. AUTHORISATION
After the authentication of the user, the application is
allowed to communicate with the API and the API
authorisation server will share an authorisation token with
the application for a secure communication. This
authorisation token will be used to request an access token
from the API authorisation server. This access token will be
used by the application to access resources (e.g. data) from
the API resource server, which will crosscheck that access
token with the API authorisation server. If this crosscheck is
successful and the access token is valid, the API resource
server should check the request for malicious characters and
sanitise the code before sending the request to the internal
systems [12].
See figure 2 for a mapping of the oauth authorisation
process with reference to LTCC.

Figure 1: LTCC API


communication

T. Jackisch, Assignment 2: API Case study ©2022 Glyndŵr University


communication need to be secured by an encryption standard
[8 p5].
A possible encryption for the access token transfer is
JSON Web Encryption (JWE) [15], which is commonly used
with JSON content, but can also be used with other types of
payload. JWE has JWT as basis and builds a token in serial
order with dot-separation, where each element is
BASE64URL-ENCODE encoded: JOSE Header, JWE
Encryption Key, Initialisation Vector, Ciphertext and
Authentication Tag [14 p185].
VII. API TYPE
Figure 2: OAuth authorisation for LTCC Different resources talking about four types of trends in
API usage [3] & [4]:
 Public API (Open for all outside Applications)
Since the access token is critical, as it can be used to open
a communication path to the API resource server, it needs to  Partner API (Available for authorised partners)
be secured. Details about encrypted communication between  Internal API (For the use only inside of a company)
the involved servers will be discussed in the encryption
paragraph.  Composite API (Combined usage)
A common solution for the access token is the JSON As the API that is planned for LTCC shall only
Web Token (JWT) [13], which acts as a container for data communicate with specific partners and must have a strong
transport and has become a widely supported standard for focus on security, the planned API will be a partner API.
modern APIs. The JWT is defined in three parts, which are Since the applications from suppliers and distributors are
the head, payload and signature, which are base64 encoded. handling the requests remote through the internet, the API is
They look like this: xxx.yyy.zzz, where every element basically a web service, which communicate with the
contain JSON formatted information [14 p157]. approach of REST or SOAP [1 p3].

V. REQUESTS VIII. TESTING


The data requests sent by the user through the application The Open Web Application Security Project (OWASP),
to the API end up providing data that is processed by internal has published a TOP10 of API security leaks in 2019, which
systems and sent back to the api. lists common flaws. These flaws are basically broken
The internal systems parse the requests and check them for authorisation and authentication on different level, data
threatening content. Furthermore, the user permissions are exposure or general security misconfiguration. This can be
checked in order to send back only data that is approved for used as a general guide to have a focus for further test cases
the user. It is important that these permissions are not only [17].
checked during processing, but also that the data is only
Beside the OWASP TOP10, general tests and validation
available with the appropriate authorisation. For example,
can be used in a process. Basically, testing the API consists
data from a database can be restricted with grants and views.
of validating the individual communication steps. To validate
If a request is incorrect, it may only be acknowledged with
the input, different parameters to be processed and the
an abstract error message. No details that are relevant for
response needs to be checked for a valid code. The JSON or
spying on vulnerabilities may be shown to the user.
XML format needs to be validated for their structure. The
If a request is valid, only the requested data may be
parsed data that is returned to the user needs to be checked if
transmitted to the user.
they are correct. It needs to be checked, what happen, if bad
Every action that happens in relation to the API triggers requests are processed and how the API responds to the user.
an event, which must be perceived and persistently recorded It needs to be checked, how the API reacts to changed
by a corresponding logging mechanism [19]. Log entries can resource data. Basically on every layer, a security test must
be subdivided and categorised hierarchically. For example, be run. [16]
Apache logging serves as an abstract toolkit for interface
Security testing can be done with a Dynamic application
logging. Levels and priorities would look like this [20]:
security testing (DAST) tool while the API is active or
 fatal: lead to premature termination SAST, when the source code is open to the testing team. In
addition to that, the access from other layers (e.g. admins)
 error: other runtime errors need to be checked for the involved systems and the general
 warn: poor use and deprecated APIs and almost errors system availability [6 p 5].
 info: non-critical but interesting events IX. CONCLUSION
 debug: system information The LTCC's API clearly focuses on safety-related issues.
This cannot be handled exclusively with encryption. Regular
 trace: detailed system information tests must be carried out in the various communications and
VI. ENCRYPTION known weak points must be dealt with. Distributors and
suppliers not only have the possibility to read data, but can
Every communication between the involved systems need also change data. For example, orders can be placed with
to be encrypted. The access token, which was discussed LTCC, causing records to be created. Security measures need
earlier, can be used to get access to the API resource server to be implemented at different levels. Data, application, API
and therefore to the data of LTCCs internal systems, this

T. Jackisch, Assignment 2: API Case study ©2022 Glyndŵr University


endpoints and network must be monitored alongside their [9] ITU, “Recommendation X.509”, Accessed 01/2022, Available:
preventive implementations, and data response must not https://www.itu.int/rec/T-REC-X.509/en
reveal critical information about the structure of API or [10] OAuth, “The Authorization Response”, Accessed 01/2022, Available:
https://www.oauth.com/oauth2-servers/authorization/the-
internal systems to a malware. authorization-response/
[11] IETF, “Transport Layer Security (tls)”, 12/2021, Accessed 01/2022,
X. REFERENCES Available: https://datatracker.ietf.org/wg/tls/documents/
[1] M. F. Ibrahim & M. A. M. Ariffin, “API Vulnerabilities In Cloud [12] OAuth, “OAuth 2.0 Authorization Code Grant”, Accessed 01/2022,
Computing Platform: Attack And Detection”, International Journal of Available: https://oauth.net/2/grant-types/authorization-code/
Engineering Trends and Technology, 10/2020, Available:
https://www.researchgate.net/publication/344867986 [13] IETF, “JSON Web Token (JWT)”, 05/2015, Accessed: 01/2022,
Available: https://datatracker.ietf.org/doc/html/rfc7519
[2] Upwork Staff, “SOAP vs. REST: A Look at Two Different API
Styles”, 08/2021, Accessed: 01/2022, Available: [14] P. Siriwardena, “Advanced API Security - OAuth 2.0 and Beyond
https://www.upwork.com/resources/soap-vs-rest-a-look-at-two- Second Edition”, apress, 2020
different-api-styles [15] IETF, “JSON Web Encryption (JWE)”, 05/2015, Accessed 01/2022,
[3] S. Castellani, “What are the different types of APIs?”, 04/2020, Available: https://datatracker.ietf.org/doc/html/rfc7516
Accessed 01/2022, Available: https://blog.axway.com/amplify- [16] A. S. Isha and M. Revathi, "Automated API Testing", 3rd
products/api-management/different-types-apis International Conference on Inventive Computation Technologies
[4] S. J. Bigelow, “What are the types of APIs and their differences?”, (ICICT), 11/2018, pp. 788-791, doi:
02/2021, Accessed: 01/2022, Available: 10.1109/ICICT43934.2018.9034254, Available:
https://searchapparchitecture.techtarget.com/tip/What-are-the-types- https://ieeexplore.ieee.org/document/9034254
of-APIs-and-their-differences [17] OWASP, “API Security Top 10 2019”, Accessed: 01/2022, Available:
[5] OAuth, “OAuth Access Tokens”, Accessed 01/2022, Available: https://owasp.org/www-project-api-security/
https://oauth.net/2/access-tokens/ [18] I. Odun-Ayo & C. Okereke & O. h. Evwieroghene, “Cloud and
[6] B. Kasthurirengan, “From Batter to Cake: Bake your Own Security Application Programming Interface”, The World Congress on
Model in API Management”, International Journal of Computer Engineering 2018 London, 07/2018, Available:
Trends and Technology Volume 68 Issue 10, 14-20, 10/2020, https://www.researchgate.net/publication/333402621_Cloud_and_Ap
Available: https://www.researchgate.net/publication/344876988 plication_Programming_Interface
[7] The OpenLDAP Project, “The OpenLDAP Project Overview”, [19] IBM, “API logging”, DataPower Gateways, Accessed 01/2022,
Accessed 01/2022, Available: https://www.openldap.org/project/ Available:
https://www.ibm.com/docs/en/datapower-gateways/2018.4?
[8] L. Tang & L. Ouyang & W.-T. Tsai, “Multi-factor web API security topic=gateway-api-logging
for securing Mobile Cloud”. 2163-2168.
10.1109/FSKD.2015.7382287, 08/2015, Available: [20] The Apache Software Foundation, “Apache Commons Logging”,
https://www.researchgate.net/publication/304293991 Accessed 01/2022, Available:
https://commons.apache.org/proper/commons-logging/guide.html

T. Jackisch, Assignment 2: API Case study ©2022 Glyndŵr University

View publication stats

You might also like