Web App Not Using TLS Last Version
- Query id: b5c851d5-00f1-43dc-a8de-3218fd6f71be
- Query name: Web App Not Using TLS Last Version
- Platform: AzureResourceManager
- Severity: Medium
- Category: Encryption
- CWE: 327
- Risk score: 5.9
- URL: Github
Description¶
Resources of type 'Microsoft.Web/sites' should define 'properties.siteConfig.minTlsVersion' with '1.2' or '1.3'
Documentation
Code samples¶
Code samples with security vulnerabilities¶
Positive test num. 1 - bicep file
resource App 'Microsoft.Web/sites@2020-12-01' = {
name: 'App'
location: resourceGroup().location
properties: {
siteConfig: {
minTlsVersion: '1.0'
}
}
}
Positive test num. 2 - json file
{
"properties": {
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.Web/sites",
"apiVersion": "2020-12-01",
"name": "App",
"location": "[resourceGroup().location]",
"properties": {
"siteConfig": {
"minTlsVersion": "1.0"
}
}
}
],
"outputs": {}
},
"parameters": {}
},
"kind": "template",
"type": "Microsoft.Blueprint/blueprints/artifacts",
"name": "myTemplate"
}
Positive test num. 3 - bicep file
resource App 'Microsoft.Web/sites@2020-12-01' = {
name: 'App'
location: resourceGroup().location
properties: {}
}
Positive test num. 4 - json file
{
"properties": {
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.Web/sites",
"apiVersion": "2020-12-01",
"name": "App",
"location": "[resourceGroup().location]",
"properties": {}
}
],
"outputs": {}
},
"parameters": {}
},
"kind": "template",
"type": "Microsoft.Blueprint/blueprints/artifacts",
"name": "myTemplate"
}
Positive test num. 5 - bicep file
Positive test num. 6 - json file
{
"properties": {
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.Web/sites",
"apiVersion": "2020-12-01",
"name": "App",
"location": "[resourceGroup().location]",
"properties": {
"siteConfig": {
"minTlsVersion": "1.1"
}
}
}
],
"outputs": {}
},
"parameters": {}
},
"kind": "template",
"type": "Microsoft.Blueprint/blueprints/artifacts",
"name": "myTemplate"
}
Positive test num. 7 - bicep file
Positive test num. 8 - json file
{
"properties": {
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.Web/sites",
"apiVersion": "2020-12-01",
"name": "App",
"location": "[resourceGroup().location]",
"properties": {
"siteConfig": {}
}
}
],
"outputs": {}
},
"parameters": {}
},
"kind": "template",
"type": "Microsoft.Blueprint/blueprints/artifacts",
"name": "myTemplate"
}
Positive test num. 9 - bicep file
Positive test num. 10 - json file
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.39.26.7824",
"templateHash": "11739403591702951112"
}
},
"resources": [
{
"type": "Microsoft.Web/sites",
"apiVersion": "2022-09-01",
"name": "meuAppService",
"location": "West Europe",
"properties": {}
},
{
"type": "Microsoft.Web/sites/config",
"apiVersion": "2022-09-01",
"name": "[format('{0}/{1}', 'meuAppService', 'web')]",
"properties": {
"minTlsVersion": "1.1"
},
"dependsOn": [
"[resourceId('Microsoft.Web/sites', 'meuAppService')]"
]
}
]
}
Positive test num. 11 - bicep file
Positive test num. 12 - json file
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.39.26.7824",
"templateHash": "750350632139492718"
}
},
"resources": [
{
"type": "Microsoft.Web/sites",
"apiVersion": "2022-09-01",
"name": "meuAppService",
"location": "West Europe",
"properties": {}
},
{
"type": "Microsoft.Web/sites/config",
"apiVersion": "2022-09-01",
"name": "[format('{0}/{1}', 'meuAppService', 'web')]",
"properties": {},
"dependsOn": [
"[resourceId('Microsoft.Web/sites', 'meuAppService')]"
]
}
]
}
Code samples without security vulnerabilities¶
Negative test num. 1 - bicep file
resource App 'Microsoft.Web/sites@2020-12-01' = {
name: 'App'
location: resourceGroup().location
properties: {
siteConfig: {
minTlsVersion: '1.3'
}
}
}
Negative test num. 2 - json file
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.Web/sites",
"apiVersion": "2020-12-01",
"name": "App",
"location": "[resourceGroup().location]",
"properties": {
"siteConfig": {
"minTlsVersion": "1.3"
}
}
}
]
}
Negative test num. 3 - bicep file
resource App 'Microsoft.Web/sites@2020-12-01' = {
name: 'App'
location: resourceGroup().location
properties: {
siteConfig: {
minTlsVersion: '1.2'
}
}
}
Negative test num. 4 - json file
{
"properties": {
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.Web/sites",
"apiVersion": "2020-12-01",
"name": "App",
"location": "[resourceGroup().location]",
"properties": {
"siteConfig": {
"minTlsVersion": "1.2"
}
}
}
],
"outputs": {}
},
"parameters": {}
},
"kind": "template",
"type": "Microsoft.Blueprint/blueprints/artifacts",
"name": "myTemplate"
}
Negative test num. 5 - bicep file
Negative test num. 6 - json file
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.Web/sites",
"apiVersion": "2022-09-01",
"name": "meuAppService",
"location": "West Europe",
"properties": {}
},
{
"type": "Microsoft.Web/sites/config",
"apiVersion": "2022-09-01",
"name": "meuAppService/web",
"dependsOn": [
"Microsoft.Web/sites/meuAppService"
],
"properties": {
"minTlsVersion": "1.2"
}
}
]
}