The security concept is separated into two parts: the vulnerabilities of the Flarecast infrastructure and the protection of confidential resources.
Infrastructure vulnerabilities
The first part concerns attacks against the infrastructure from external or internal sources. This includes any kind of vectors including data manipulation as well as service disruption.
Security vulnerabilities affects two aspects of the infrastructure:
- Internal infrastructure which is only available over a secure connection (SSH) and by authenticated users
- Infrastructure with public interfaces which obtains data by a read-only database
An attack on the internal infrastructure is very unlikely due the secure connection and the insensitive nature of space weather data. To reduce the vulnerability on the public interfaces we provide a separate database with read-only access which is periodically synchronized with the internal Flarecast database. Hereby, only attacks involving a service disruption are possible.
The following table gives a summary of possible attack vectors, there risk and impact level as well as possible countermeasures.
Attack Vector | Description | Security Notes | Risk Level (1 - 5) | Impact Level (1 - 5) | Recommended Countermeasure |
---|---|---|---|---|---|
Attacks concerning general web applications | |||||
Session hijacking | Attacker uses e.g. a man-in-the-middle attack while victim has an open connection to the web application. Hereby, the attacker obtains the authorized session ID of the victim. | Due a required SSH connection it is very unlikely as an attacker gets access to the internal infrastructure. | 1 | 5 | Keep informed about issues concerning secure connections (e.g. OpenSSL vulnerability CVE-2016-6304). |
Cross-site request forgery (XSRF, CSRF) | Victim has an open connection to the web application and runs a malicious script downloaded from an attacker's server. | Depends on web browser. All modern browsers support same-origin-policy. | 1 | 4 | Use Nonce tokens. |
Session fixation | Attacker provides a URL, e.g. by mail, with a pre-defined session ID to the victim. As soon as the victim logs into the trusted web application the attacker can use the same session ID for his own requests. | Due a required SSH connection it is very unlikely as an attacker gets access to the internal infrastructure. | 1 | 3 | Inform end-users about the risk. Verify provided URLs wherever they are manipulated. |
Cross-site scripting (XSS) | Victim/Docker container uploads malicious script which is executed while visualizing data by a web service. | - | 1 | 4 | Use character escaping. |
Open redirection | Attacker provides a URL, e.g. to a trusted login site, with a manipulated redirection parameter to the victim. After the victim logged into the system the trusted web application redirects the victim to the malicious web site, e.g. a copy of the original site. | This may be a problem with oAuth2 and the 'token' response type. Not trivial as oAuth2 validates the redirection URL. | 1 | 2 | Use character escaping. |
Mixed content | Due the mix of resources partly available by HTTP and partly by HTTPS e.g. a man-in-the-middle attack is possible. | Due a required SSH connection it is very unlikely as an attacker gets access to the internal infrastructure. | 1 | 0 | - |
Cross-site script inclusion (XSSI) | Victim has an open VPN session and forwards JSON responses due a malicious script downloaded from an attacker's server. | Possible but harmless, as all available resources are non-confidential. | 0 | 0 | - |
Header injection (response splitting) | Victim/Attacker sends a request with a manipulated header field provided as query parameter which is then used within the response header. | There is no route which allows to set the response's header information. | 0 | 0 | - |
Referer leakage | Victim calls an external link from a sensitive URL which is then published within the 'referer' header field of the request to the external site. | Harmless. | 0 | 0 | - |
Specific to the design of web applications | |||||
Denial-of-service (DoS) attacks | Attacker disrupt service by flooding it with requests. | Due a dedicated DDoS mitigation appliance. | 4 | 4 | - |
Cache poisoning | Victim's browser cache or proxy gets poisoned with a malicious version of the target web application, e.g. due 'header injection' or a DDoS attack. This may result in a XSS where the script's origin is equal to the target's web application. | Depends on the client environment (browser, proxy, ...). | 2 | 4 | Keep informed about proxy/caching issues. However, cache poisoning is very hard to detect! |
Content and character set sniffing | The victim's browser tries to 'correctly interpret' inconsistent content or character sets. E.g., an UTF-7 coded script may be interpreted as valid code also the website's character set is UTF-8. This may bypass the (UTF-8) character escaping on the server-side and allows XSS. | - | 1 | 4 | Check encoding of uploaded data. |
Clickjacking | The target web application is overlayed with a transparent site provided by the attacker. Victim's interactions are undesirably send to the attackers site. | - | 1 | 1 | Use "frame-breaker" script. |
Cookie forcing (cookie injection) | Attacker injects a cookie into the context of a web application, e.g. using a man-in-the-middle attack, which could be used with session fixation. | Unlikely, due a required SSH connection to the internal infrastructure. | 1 | 1 | Unknown ![]() |
Framebusting | Attacker encloses the victims framed web application inside his own frame. Hereby, if the web application e.g. uses the javascript object parent.location it access the attackers frame instead of its own top-level document. | This is not an issue as no frame is used by any Flarecast service. | 0 | 0 | - |
HTTP downgrade | Attacker forces victim, e.g. by DDoS, to use HTTP instead of HTTPS for connecting to a web application. | Harmless, due a required SSH connection to the internal infrastructure. | 0 | 0 | - |
Specific to the server-side code | |||||
Command injection (SQL, shell, PHP, …) | Given URL parameters are unintendedly processed as statements due insufficient input filtering. E.g. a malicious script from XSS could produce a HTTP request for a resource which ID filter parameter is a masked SQL statements. | - | 2 | 4 | Use character escaping. |
Directory traversal | An attacker or script travers systematically a web application's paths searching for files at arbitrary locations. | Harmless, as the Flarecast infrastructure do not provide sensitive files. | 0 | 0 | - |
Parameter Tampering | An attacker or script manipulates systematically an URL's parameter to access arbitrary resources. E.g. incrementing the URL's filter ID on a page to view a specific resource. | Harmless, as the Flarecast infrastructure do not provide sensitive resources. | 0 | 0 | - |
File inclusion | An attacker or script specifies a remote file to read from within a HTML request. E.g. a web application expects a language, e.g. 'en', as parameter which is used to load a local translation file but gets a URL. | Harmless, as the Flarecast infrastructure do not provide file related parameters. | 0 | 0 | - |
Buffer overflow / | Vulnerabilities mainly related to web applications written in a low-level programming language such as C or C++. Hereby, the attacker tries to provoke an undesired behavior by the web application due memory corruption. | Harmless, as the Flarecast infrastructure is written in Python; overflows produce exceptions. | 0 | 0 | - |
Specific to Flarecast | |||||
Running malicious containers | Attacker or victim injects a malicious algorithm as Docker container within the Flarecast infrastructure. | - | 3 | 4 | Define reviewing process for Docker containers. |
Authentication mechanisms
The second part concerns a user and client management system for preventing undesired data manipulations within the internal infrastructure as well as protecting administrative operations.
While it is convenient for end-users to authenticate themselves over a login page applications require an automated process. Hereby, we introduce two authentication mechanisms for end-users and applications, such as Flarecast services and algorithms.
Authentification Mechanism | Used By | Description | Protection Level |
---|---|---|---|
Session Login | End-Users | Restricts the permission on specific routes by validating the session ID of a request. If an end-user does not hold an approved session ID he has to authenticate himself over a login page with a username and password. If the login was successful, the end-user's session ID becomes active. | Web pages with restricted functions. |
oAuth2 (RFC6749) | Applications | Restricts the permission on specific routes by validating an access token within the request's header. If an application does not hold an active access token it has to request a token from the oAuth2 authorisation server. Each route is tagged with one or multiple 'scopes' which groups protected resources. An access token is related with a list of scopes and only provides access to correspondingly tagged resources. | Restricted REST resources. |
Depending on the use-case, oAuth2 provides multiple authentication and administration methods, called grant types, which are given in the following table. Hereby, an application, called client, can request an access token for a specific scope set.
Method | Description | Parameter | Example | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Authorization Code | An end-user authorizes a specific client for a set of resources. The application can then request the corresponding access token provided by the end-user. |
| Response: | ||||||||
Client Credentials | Given a client is owner of a set of resources, it can request a corresponding access token itself. |
| Request: Response: | ||||||||
Password | Clients are grouped into public and confidential clients. Hereby, a 'confidential' clients is allowed to request an access token in the name of an end-user. |
| Response: | ||||||||
Refresh Token | Access tokens expire after a certain period. To expand a valid access token the client can request a new one using a corresponding refresh tokent. |
| Response: |
* The redirect_uri is validated by oAuth2 due open redirection vulnerabilities. (see previous section)
In some scenarios, e.g. with the grant type "Authorization Code", a client probably would like to verify its received access token. As the RFC6749 for oAuth2 does not define such a scenario we adapted a common implementation, e.g. used by Google and Amazon, which provides a separate URL:
Method | Description | Parameter | Example | ||
---|---|---|---|---|---|
Verify Access Token | Allows a client to verify an access token not directly requested from the oAuth2 server. |
| Request: Response: |
The following examples show concrete use-cases where the session login and oAuth2 mechanisms are used within the Flarecast infrastructure.
InfraViewer
Request Description Response POST /login The end-user performs a login with his username and password. The InfraViewer verifies the user's authentication and, if successful, requests an access token from the oAuth2 server (using the 'password' grant type). The end-user is then redirected to his original page either with or without a valid session ID and access token cookie. Depending on those cookies the end-user gets access to restricted operations, depending on his session ID, or can request secured resources, using his access token. GET /resource_1 The end-user requests a non-secured resource from the InfraViewer. The InfraViewer response with the requested JSON object, without requiring any authentication. POST /resource_1 The end-user requests a secured resource from the InfraViewer. The InfraViewer response either with the requested JSON object, given a valid access token, or with an error page. Swagger UI
Request Description Response GET /oauth/authorize The end-user requests an access token for the Swagger UI which then can access secured resources. If the end-user holds a valid session ID he is redirected to an authorization page from the oAuth2 server where he can grant Swagger UI to request an access token (using the 'authorization code' grant type). Otherwise, the user is redirected to a login form where he needs to authenticate himself before accessing the authorization page. GET /resource_1 The end-user requests a non-secured resource from the Swagger UI. The Swagger UI response with the requested JSON object, without requiring any authentication. POST /resource_1 The end-user requests a secured resource from the Swagger UI. The Swagger UI response either with the requested JSON object, given a valid access token, or with an error page. Algorithms within a Docker container
Request Description Response GET /resource_1 The algorithm requests a non-secured resource from the Swagger UI. The service response with the requested JSON object, without requiring any authentication. POST /resource_1 The algorithm requests a secured resource from the Swagger UI. The service response either with the requested JSON object, given a valid access token, or with an error page. The algorithm's access token is injected by the Workflow Management Service during startup. Hence, only algorithms running on the cluster obtain a valid access token to manipulate data within the infrastructure.
The above workflows are slightly simplified as the web-based user interfaces (UIs) and the REST interfaces, both services in terms of Flarecast, are separated. Hereby, the UIs represent clients, in terms of oAuth2, which use access tokens to access the protected REST resources, e.g. from the property service. Note as Swagger as such represents a oAuth2-secured REST interface while Swagger UI is only a graphical interface, not holding any resources itself.
Technical Details
By the above section we described the workflows of a session login and oAuth2 authentication. The concrete implementation is given by two Flask-add-ons which are built on the top of our web servers used within the Flarecast infrastructure.
Python Package | Description | URL / Documentation |
---|---|---|
flask-login (0.4.0) | User session management support for Flask. | https://flask-login.readthedocs.io/en/latest/ |
flask-oauthlib (0.9.3) | oAuth1/oAuth2 client and provider support for Flask. Build with the oauthlib. | https://flask-oauthlib.readthedocs.io/en/latest/ |
The integration of the two packages can be found within the python-base image. Hereby, the following files are involved:
flask_login:
File
Description Highlights /flarecast/service/flarecast_service.py Wrapper class for the Connexion framework (including Flask & Swagger). /flarecast/service/models.py Module which holds all models required by flask_login and flask_oauthlib. /flarecast/service/users/views.py Blueprint of the user login and logout pages. /flarecast/service/admin_dao.py The data access object (DAO) which maps requests and database cursers to database queries and python objects. flask_oauthlib
File
Description Highlights /flarecast/service/flarecast_service.py Wrapper class for the Connexion framework (including Flask & Swagger). /flarecast/service/models.py Module which holds all models required by flask_login and flask_oauthlib. /flarecast/service/oauth/views.py Blueprint for authorize, access, revoke and validate access tokens. Each route is wrapped by a function provided by flask_oauthlib which implements the authorization flow. /flarecast/service/admin_dao.py The data access object (DAO) which maps requests and database cursers to database queries and python objects.
A last missing fragment is the database schema which persistently stores the users, clients and tokens referred above:
The central entity is the user which, by assumption, owns resources he grants access to. A client can then define reliable clients and administrate there grant as well as bearer (access) tokens. This workflow however is not defined by the above database schema nor oAuth2. Flarecast do not provide corresponding functionalities for managing users at the moment, so each user has to be manually added to the database. Furthermore, a fine-grained user management system may add some user roles which could then be mapped to specific scopes. An example is given by the following table:
User Role | Resource Scope | Example |
---|---|---|
Reader | read | Access to protected routes for querying configurations of prediction algorithms. |
Writer | write | Access to protected routes for adding prediction data to existing predictions. |
Moderator | read, write | Full (read and write) access to the prediction service. |
Administrator | read, write, execute | Full access to the workflow management service, including protected routes for running and stopping Docker containers. |