Global Security Scheme Using Basic Authentication
- Query id: 77276d82-4f45-4cf1-8e2b-4d345b936228
- Query name: Global Security Scheme Using Basic Authentication
- Platform: OpenAPI
- Severity: Low
- Category: Access Control
- URL: Github
Description¶
A security scheme is allowing basic authentication credentials to be transported over network
Documentation
Code samples¶
Code samples with security vulnerabilities¶
Positive test num. 1 - json file
{
"openapi": "3.0.0",
"info": {
"title": "Simple KICS API",
"version": "1.0.0"
},
"paths": {
"/": {
"get": {
"operationId": "listVersions",
"summary": "List versions",
"responses": {
"200": {
"description": "200 response",
"content": {
"application/json": {
"examples": {
"foo": {
"value": {
"versions": [
{
"status": "CURRENT",
"updated": "2011-01-21T11:33:21Z",
"id": "v2.0",
"links": [
{
"href": "http://127.0.0.1:8774/v2/",
"rel": "self"
}
]
}
]
}
}
}
}
}
}
}
}
}
},
"servers": [
{
"url": "http://kicsapi.server.com/",
"description": "API server"
}
],
"components": {
"securitySchemes": {
"regularSecurity": {
"type": "http",
"scheme": "basic"
}
}
}
}
Positive test num. 2 - yaml file
openapi: 3.0.0
info:
title: Simple API overview
version: 1.0.0
paths:
"/":
get:
operationId: listVersions
summary: List versions
responses:
"200":
description: 200 response
content:
application/json:
examples:
foo:
value:
versions:
- status: CURRENT
updated: "2011-01-21T11:33:21Z"
id: v2.0
links:
- href: http://127.0.0.1:8774/v2/
rel: self
servers:
- url: http://kicsapi.server.com/
description: API server
components:
securitySchemes:
regularSecurity:
type: http
scheme: basic
Code samples without security vulnerabilities¶
Negative test num. 1 - json file
{
"openapi": "3.0.0",
"info": {
"title": "Simple KICS API",
"version": "1.0.0"
},
"paths": {
"/": {
"get": {
"operationId": "listVersions",
"summary": "List versions",
"responses": {
"200": {
"description": "200 response",
"content": {
"application/json": {
"examples": {
"foo": {
"value": {
"versions": [
{
"status": "CURRENT",
"updated": "2011-01-21T11:33:21Z",
"id": "v2.0",
"links": [
{
"href": "http://127.0.0.1:8774/v2/",
"rel": "self"
}
]
}
]
}
}
}
}
}
}
}
}
}
},
"servers": [
{
"url": "https://kicsapi.server.com/",
"description": "API server"
}
],
"components": {
"securitySchemes": {
"OAuth2": {
"type": "oauth2",
"flows": {
"authorizationCode": {
"scopes": {
"write": "modify objects",
"read": "read objects"
},
"authorizationUrl": "https://kicsapi.com/oauth/authorize",
"tokenUrl": "https://kicsapi.com/oauth/token"
}
}
}
}
},
"security": [
{
"OAuth2": [
"write",
"read"
]
}
]
}
Negative test num. 2 - yaml file
openapi: 3.0.0
info:
title: Simple KICS API
version: 1.0.0
paths:
"/":
get:
operationId: listVersions
summary: List versions
responses:
"200":
description: 200 response
content:
application/json:
examples:
foo:
value:
versions:
- status: CURRENT
updated: "2011-01-21T11:33:21Z"
id: v2.0
links:
- href: http://127.0.0.1:8774/v2/
rel: self
servers:
- url: https://kicsapi.server.com/
description: API server
components:
securitySchemes:
OAuth2:
type: oauth2
flows:
authorizationCode:
scopes:
write: modify objects in your account
read: read objects in your account
authorizationUrl: https://kicsauthenticator.com/oauth/authorize
tokenUrl: https://kicsauthenticator.com/oauth/token
security:
- OAuth2:
- write
- read