SlideShare a Scribd company logo
1 of 42
Secure your Web App in Azure
@flytzen - https://neworbit.co.uk
Introduction
Frans Lytzen, CTO NewOrbit
https://www.Lytzen.name
https://neworbit.pl
@flytzen
@flytzen - https://neworbit.co.uk
Scope
• Hosting a web app in Azure App Services
• Functions are basically they same so what I say here goes for them too
• There are a lot of concepts and tools – I will try to give you an
overview so you can choose what is right for you
• Many individual slides in this talk could fill the whole session.
• I won’t – can’t – cover everything
• It’s mainly infrastructure and configuration – but the few code
examples are in .Net just because I use that most.
@flytzen - https://neworbit.co.uk
Concepts
@flytzen - https://neworbit.co.uk
@flytzen - https://neworbit.co.uk
Understand your exposure
• Internal actors are probably a bigger threat than external actors
• Usually more through stupidity than evil intent
• How sensitive is your data?
• How bad would it actually be for your business if all the data in your
system was leaked on the internet?
• How likely are you to be directly targeted?
• You are always vulnerable to “drive-by” attacks
• There is no such thing as 100% secure – there is only “an
appropriate security level for a given risk level”
@flytzen - https://neworbit.co.uk
Concepts
Prevent
Detect
Mitigate
@flytzen - https://neworbit.co.uk
Concepts
External Actors Internal Actors
PREVENT • Secure your code – see Troy Hunt’s courses as
a starting point.
• Lock down your servers
• Use Firewalls and Intrusion
Detection/Prevention Systems
• Encrypt everything in transit
• Protect your passwords/secrets
• Process for granting and removing access
• Use Azure AD for all access, including SQL
• Audit who has access on a regular basis and
remove unnecessary access
DETECT • Log and alert on any unusual application
activity
• 403s and 404s
• Failed logins
• High CPU/memory, increased load
• Etc
• Use Advanced Threat Protection
• Log and alert on all access to the backend by
internal users
• Log and alert on unusual access patterns by
application users
• Consider DLP tools
MITIGATE • Encrypt sensitive data at the application layer
• Have ways of locking out certain users or IP addresses
• For very sensitive systems, consider multi-layered architectures to contain breaches
@flytzen - https://neworbit.co.uk
Idealised
Getting in
Secret
Management
Network Isolation
Encryption
Detection
Getting in
@flytzen - https://neworbit.co.uk
Make your code secure
Watch Troy Hunt’s courses a starting point
@flytzen - https://neworbit.co.uk
@flytzen - https://neworbit.co.uk
Can I have my own firewall?
• Can I have my own firewall?
• Not really, no – but you don’t need it.
• Can I use a WAF (Web Application Firewall)?
• Yes – if you must.
• You can limit access to your web app to specific IP
addresses (i.e. the WAF).
• You can configure a Web App to only accept traffic from a
certain vnet, but that is more for micro-services or for
gateways to on-premise networks.
@flytzen - https://neworbit.co.uk
TLS/SSL
• Require HTTPs for all traffic
• Azure’s built-in
“HTTPS Only” may
interfere with “Always On”
• Consider Let’s Encrypt Website Plugin
for free, automated SSL Certificates.
• BUT: It requires you to put powerful
credentials in clear-text in the app
configuration settings.
• App Service Certificates allows you to buy
SSL certificates from Microsoft, directly in
the portal.
• Remember to talk to all your back-end
dependencies using TLS as well.
ADB2C Authentication
@flytzen - https://neworbit.co.uk
ADB2C/AAD Authentication benefits
• You can use Azure AD (i.e. Office 365 accounts) and/or Azure
AD B2C to manage logins to your application.
• ADB2C is “login as a service” that you can use for users in your
application.
• They both provide very powerful security features, including
Multi Factor Authentication (MFA) and machine-learning based
detection of suspicious logins.
• Provides oAuth2 tokens for SPAs and other consumers.
• Provides a sign-up flow as well (beware of 15 minute time limit)
• Can integrate to other SSO providers
@flytzen - https://neworbit.co.uk
@flytzen - https://neworbit.co.uk
ADB2C / AAD Authentication options
Let Azure handle it all Handle it in code
Secret management
Avoid anyone being able to impersonate your application by not storing credentials in clear
text
@flytzen - https://neworbit.co.uk
Getting in
Secret
Management
Network
Isolation
Encryption
Detection
What you should achieve
• Credentials for databases etc should not be stored anywhere
where a developer or an ops person can get them.
• Can be accidentally leaked. Password in source code, anyone?
• You may not reset them when someone leaves.
• Someone will use them to access the database etc – and you won’t
know it was them.
• Use Service Principals to authenticate to other services where
possible.
• Use Managed Identity so no-one “knows the password” for the
application.
@flytzen - https://neworbit.co.uk
Service Principals
• A Service Principal is really just
an Azure AD user that is intended
to be used by an application. It
can have permissions and roles,
just like a normal user.
• Except, you have to “create an
app” – which can be counter
intuituve. Just embrace the
weirdness.
• In the portal, Azure Active
Directory -> App Registration
(choose Web and give it a dummy
url) @flytzen - https://neworbit.co.uk
Managed Identity
• Azure will create a Service
Principal for your web app.
• You can get a bearer token for
that Service Principal using an
API running on localhost on the
Web App => It can only ever be
used by your web app.
• In C# it’s as simple as
var atp = new AzureServiceTokenProvider();
(locally, that will seamlessly use your
account instead)
@flytzen - https://neworbit.co.uk
Use Azure Key Vault for Secrets
• Add secrets, like Azure Storage connection
strings in Azure Key Vault
• Give your Web App’s Managed Identity
Service Principal access to read the secrets
• Add secrets to the Key Vault
@flytzen - https://neworbit.co.uk
@flytzen - https://neworbit.co.uk
Retrieve secrets from Key Vault
Nuget Packages: Microsoft.Azure.Services.AppAuthentication and Microsoft.Azure.KeyVault
using Microsoft.Azure.Services.AppAuthentication;
using Microsoft.Azure.KeyVault;
// Instantiate a new KeyVaultClient object, with
an access token to Key Vault
var atp = new AzureServiceTokenProvider();
var kv = new KeyVaultClient(new
KeyVaultClient.AuthenticationCallback(atp.KeyVault
TokenCallback));
// Retrieve an individual secret called "secret"
var secret = await kv.GetSecretAsync(
"https://[keyvaultname].vault.azure.net/secrets/secret");
var secretValue = secret.Value;
using Microsoft.Azure.Services.AppAuthentication;
using Microsoft.Azure.KeyVault;
var atp = new AzureServiceTokenProvider();
var kv = new KeyVaultClient(new
KeyVaultClient.AuthenticationCallback(atp.KeyVaultT
okenCallback));
var builder = new ConfigurationBuilder()
.AddJsonFile("appsettings.json")
.AddEnvironmentVariables()
.AddAzureKeyVault(
"https://[keyvaultname].vault.azure.net/",
kv, new DefaultKeyVaultSecretManager());;
General Purpose ASP.Net Core Config Integration
Connect to Azure SQL using Managed
Identity
• Add your Managed Identity Service principal
as a user to the SQL Database.
• It’s a bit long-winded how to do that properly
so I will skip over it here. The easiest, but not
best, way is to;
• Create a Security Group in Azure AD
• Add your Managed Identity Service Principal to that
Group
• Make that Group the “AD Admin” of your Azure SQL
Server (not database)
• Better way is to add the Service Principal as a
user in SQL using T-SQL and giving it only the
appropriate rights.
@flytzen - https://neworbit.co.uk
Connect to Azure SQL using Managed
Identity
• Remove Username and Password from your Connection String
• Add a constructor like this to your DbContext:
@flytzen - https://neworbit.co.uk
public MyDatabaseContext(SqlConnection conn) : base(conn, true)
{
conn.ConnectionString = [retrieve connection string from config];
conn.AccessToken = (
new AzureServiceTokenProvider())
.GetAccessTokenAsync("https://database.windows.net/").Result;
}
Requires .Net 4.6 or .Net Core 2.2
Network isolation
Avoid people listening in and make it harder to attack
@flytzen - https://neworbit.co.uk
Getting in
Secret
Management
Network
Isolation
Encryption
Detection
@flytzen - https://neworbit.co.uk
Limit access to back-end services
• Create a Virtual Network
and a Subnet
• Add Service End Points
for each type of Service
• Restrict access to each
service to limit it to only
traffic from that vNet
• Allow the Web App to use
that vNet
• There is a performance
benefit too
• Note: it often takes 15-30
minutes before changes
take effect!
@flytzen - https://neworbit.co.uk
Block access to SQL Server
@flytzen - https://neworbit.co.uk
Allow Web App to use VNet
Encryption
@flytzen - https://neworbit.co.uk
Getting in
Secret
Management
Network
Isolation
Encryption
Detection
@flytzen - https://neworbit.co.uk
Layers
• Encrypted on the wire
• On by default
• Check your connection strings and settings
Transport
Encryption
• The data is encrypted on the disk
• On by default for almost everything
• Meaningless, but a tick in a box
Encryption
at Rest
• Encrypt data at the application layer so even
users with access to the backend can’t read it.
• SQL and Storage supports it
• .Net Core support is coming
Application-
layer
encryption
@flytzen - https://neworbit.co.uk
Storage
Client-side
encryption• Blobs, Tables and Queues are all supported, but
obviously use different setups to function.
• Azure Key Vault is used to automatically manage the
secrets
• The Storage libraries have native support for it.
• Set up Key Vault using your Managed Identity as discussed
above
• Items will automatically be encrypted and decrypted with
rotating keys.
• Even users with legitimate access to your storage account will
only see encrypted data
@flytzen - https://neworbit.co.uk
SQL Always Encrypted
@flytzen - https://neworbit.co.uk
SQL Always Encrypted
• create, get, list, sign, verify, wrapKey, and unwrapKey Key
Vault Policy permission are required.
• Change your connection string to include
; Column Encryption Setting=enabled;
private static void TellEFToUseKeyVaultForConnections()
{
var providers = new Dictionary<string, SqlColumnEncryptionKeyStoreProvider>
{ { SqlColumnEncryptionAzureKeyVaultProvider.ProviderName,
new SqlColumnEncryptionAzureKeyVaultProvider(GetAuthToken) } };
// This is a static method
SqlConnection.RegisterColumnEncryptionKeyStoreProviders(providers);
}
// GetAuthToken is a KeyVault callback similar to what we did for authentication earlier
Detection
How do you know you are being attacked?
How do you know if your own people are accessing data they shouldn’t?
@flytzen - https://neworbit.co.uk
Getting in
Secret
Management
Network
Isolation
Encryption
Detection
Automated alerts
Machine Learning-based tools to automatically tell when
something is not normal
@flytzen - https://neworbit.co.uk
Application
Insights
• Just switch on
Application Insights and
it will “baseline” your
application and alert you
when things are
“different to normal”.
• Unless hackers are very
careful, they will cause
disturbances as they
prod your system.
@flytzen - https://neworbit.co.uk
Threat
Detection
• Part of SQL Advanced
Data Security
• In preview for Storage
• Base-lines “normal”
behaviour in your app and
alerts you to changes.
• Detects SQL injection and
other common attack
patterns.
@flytzen - https://neworbit.co.uk
Manual Alerts
• Look for specific patterns you know are suspicious
• A rise in 404s may mean someone is scanning your app to find
vulnerable URLs
• A rise in 403s may mean an authenticated user is trying to
escalate their privileges (basically trying to access URLs they
are not meant to)
• A rise in failed logins may mean someone is trying to guess a
username/password
• You need to know when your operators read data directly from
SQL
@flytzen - https://neworbit.co.uk
Alerts in
Application
Insights
• Application Insights ->
Analytics -> New Alert
Rule
• Create a search, tell it
how often to run and
when to email you.
@flytzen - https://neworbit.co.uk
Alerts in SQL
• Configure SQL to write
all SQL statements to
Log Analytics
• Create an alert that tells
you each day who –
other than your
application – logged in.
@flytzen - https://neworbit.co.uk
SQL Advanced Data Security
• Includes Threat Detection
• Analyses your database to find weaknesses, such as too many
users etc.
• Analyses your database to find potentially sensitive data.
• A fantastic tool for compliance and ongoing monitoring.
@flytzen - https://neworbit.co.uk
Closing notes
@flytzen - https://neworbit.co.uk
What
Questions do
you have?
@flytzen - https://neworbit.co.uk

More Related Content

What's hot

Hacking Samsung's Tizen: The OS of Everything - Hack In the Box 2015
Hacking Samsung's Tizen: The OS of Everything - Hack In the Box 2015Hacking Samsung's Tizen: The OS of Everything - Hack In the Box 2015
Hacking Samsung's Tizen: The OS of Everything - Hack In the Box 2015Ajin Abraham
 
Beyond the Pentest: How C2, Internal Pivoting, and Data Exfiltration Show Tru...
Beyond the Pentest: How C2, Internal Pivoting, and Data Exfiltration Show Tru...Beyond the Pentest: How C2, Internal Pivoting, and Data Exfiltration Show Tru...
Beyond the Pentest: How C2, Internal Pivoting, and Data Exfiltration Show Tru...Beau Bullock
 
Secure deployments keeping your application secrets private -duug fest
Secure deployments   keeping your application secrets private -duug festSecure deployments   keeping your application secrets private -duug fest
Secure deployments keeping your application secrets private -duug festHenry Been
 
Abusing, Exploiting and Pwning with Firefox Add-ons
Abusing, Exploiting and Pwning with Firefox Add-onsAbusing, Exploiting and Pwning with Firefox Add-ons
Abusing, Exploiting and Pwning with Firefox Add-onsAjin Abraham
 
[Wroclaw #4] WebRTC & security: 101
[Wroclaw #4] WebRTC & security: 101[Wroclaw #4] WebRTC & security: 101
[Wroclaw #4] WebRTC & security: 101OWASP
 
20+ Ways to Bypass Your macOS Privacy Mechanisms
20+ Ways to Bypass Your macOS Privacy Mechanisms20+ Ways to Bypass Your macOS Privacy Mechanisms
20+ Ways to Bypass Your macOS Privacy MechanismsSecuRing
 
Hacking Tizen: The OS of everything - Whitepaper
Hacking Tizen: The OS of everything - WhitepaperHacking Tizen: The OS of everything - Whitepaper
Hacking Tizen: The OS of everything - WhitepaperAjin Abraham
 
Istio Security Overview
Istio Security OverviewIstio Security Overview
Istio Security OverviewMichael Furman
 
Hacking Tizen : The OS of Everything - Nullcon Goa 2015
Hacking Tizen : The OS of Everything - Nullcon Goa 2015Hacking Tizen : The OS of Everything - Nullcon Goa 2015
Hacking Tizen : The OS of Everything - Nullcon Goa 2015Ajin Abraham
 
Lacework | Top 10 Cloud Security Threats
Lacework | Top 10 Cloud Security ThreatsLacework | Top 10 Cloud Security Threats
Lacework | Top 10 Cloud Security ThreatsLacework
 
Containerizing your Security Operations Center
Containerizing your Security Operations CenterContainerizing your Security Operations Center
Containerizing your Security Operations CenterJimmy Mesta
 
JHipster and Okta - JHipster Virtual Meetup December 2020
JHipster and Okta - JHipster Virtual Meetup December 2020JHipster and Okta - JHipster Virtual Meetup December 2020
JHipster and Okta - JHipster Virtual Meetup December 2020Matt Raible
 
Security in Serverless world
Security in Serverless worldSecurity in Serverless world
Security in Serverless worldYan Cui
 
Owasp Mobile Risk Series : M3 : Insufficient Transport Layer Protection
Owasp Mobile Risk Series : M3 : Insufficient Transport Layer ProtectionOwasp Mobile Risk Series : M3 : Insufficient Transport Layer Protection
Owasp Mobile Risk Series : M3 : Insufficient Transport Layer ProtectionAnant Shrivastava
 
Secure deployments keeping your application secrets private - condensed
Secure deployments   keeping your application secrets private - condensedSecure deployments   keeping your application secrets private - condensed
Secure deployments keeping your application secrets private - condensedHenry Been
 
Hta t07-did-you-read-the-news-http-request-hijacking
Hta t07-did-you-read-the-news-http-request-hijackingHta t07-did-you-read-the-news-http-request-hijacking
Hta t07-did-you-read-the-news-http-request-hijackingКомсс Файквэе
 
The ABCs of Source-Assisted Web Application Penetration Testing With OWASP ZA...
The ABCs of Source-Assisted Web Application Penetration Testing With OWASP ZA...The ABCs of Source-Assisted Web Application Penetration Testing With OWASP ZA...
The ABCs of Source-Assisted Web Application Penetration Testing With OWASP ZA...Denim Group
 
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...Matt Raible
 

What's hot (20)

Hacking Samsung's Tizen: The OS of Everything - Hack In the Box 2015
Hacking Samsung's Tizen: The OS of Everything - Hack In the Box 2015Hacking Samsung's Tizen: The OS of Everything - Hack In the Box 2015
Hacking Samsung's Tizen: The OS of Everything - Hack In the Box 2015
 
Beyond the Pentest: How C2, Internal Pivoting, and Data Exfiltration Show Tru...
Beyond the Pentest: How C2, Internal Pivoting, and Data Exfiltration Show Tru...Beyond the Pentest: How C2, Internal Pivoting, and Data Exfiltration Show Tru...
Beyond the Pentest: How C2, Internal Pivoting, and Data Exfiltration Show Tru...
 
Secure deployments keeping your application secrets private -duug fest
Secure deployments   keeping your application secrets private -duug festSecure deployments   keeping your application secrets private -duug fest
Secure deployments keeping your application secrets private -duug fest
 
Abusing, Exploiting and Pwning with Firefox Add-ons
Abusing, Exploiting and Pwning with Firefox Add-onsAbusing, Exploiting and Pwning with Firefox Add-ons
Abusing, Exploiting and Pwning with Firefox Add-ons
 
[Wroclaw #4] WebRTC & security: 101
[Wroclaw #4] WebRTC & security: 101[Wroclaw #4] WebRTC & security: 101
[Wroclaw #4] WebRTC & security: 101
 
20+ Ways to Bypass Your macOS Privacy Mechanisms
20+ Ways to Bypass Your macOS Privacy Mechanisms20+ Ways to Bypass Your macOS Privacy Mechanisms
20+ Ways to Bypass Your macOS Privacy Mechanisms
 
Hacking Tizen: The OS of everything - Whitepaper
Hacking Tizen: The OS of everything - WhitepaperHacking Tizen: The OS of everything - Whitepaper
Hacking Tizen: The OS of everything - Whitepaper
 
Spa Secure Coding Guide
Spa Secure Coding GuideSpa Secure Coding Guide
Spa Secure Coding Guide
 
Istio Security Overview
Istio Security OverviewIstio Security Overview
Istio Security Overview
 
Hacking Tizen : The OS of Everything - Nullcon Goa 2015
Hacking Tizen : The OS of Everything - Nullcon Goa 2015Hacking Tizen : The OS of Everything - Nullcon Goa 2015
Hacking Tizen : The OS of Everything - Nullcon Goa 2015
 
Lacework | Top 10 Cloud Security Threats
Lacework | Top 10 Cloud Security ThreatsLacework | Top 10 Cloud Security Threats
Lacework | Top 10 Cloud Security Threats
 
Containerizing your Security Operations Center
Containerizing your Security Operations CenterContainerizing your Security Operations Center
Containerizing your Security Operations Center
 
JHipster and Okta - JHipster Virtual Meetup December 2020
JHipster and Okta - JHipster Virtual Meetup December 2020JHipster and Okta - JHipster Virtual Meetup December 2020
JHipster and Okta - JHipster Virtual Meetup December 2020
 
Security in Serverless world
Security in Serverless worldSecurity in Serverless world
Security in Serverless world
 
Owasp Mobile Risk Series : M3 : Insufficient Transport Layer Protection
Owasp Mobile Risk Series : M3 : Insufficient Transport Layer ProtectionOwasp Mobile Risk Series : M3 : Insufficient Transport Layer Protection
Owasp Mobile Risk Series : M3 : Insufficient Transport Layer Protection
 
Anatomy of a Cloud Hack
Anatomy of a Cloud HackAnatomy of a Cloud Hack
Anatomy of a Cloud Hack
 
Secure deployments keeping your application secrets private - condensed
Secure deployments   keeping your application secrets private - condensedSecure deployments   keeping your application secrets private - condensed
Secure deployments keeping your application secrets private - condensed
 
Hta t07-did-you-read-the-news-http-request-hijacking
Hta t07-did-you-read-the-news-http-request-hijackingHta t07-did-you-read-the-news-http-request-hijacking
Hta t07-did-you-read-the-news-http-request-hijacking
 
The ABCs of Source-Assisted Web Application Penetration Testing With OWASP ZA...
The ABCs of Source-Assisted Web Application Penetration Testing With OWASP ZA...The ABCs of Source-Assisted Web Application Penetration Testing With OWASP ZA...
The ABCs of Source-Assisted Web Application Penetration Testing With OWASP ZA...
 
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...
 

Similar to Secure your web app presentation

Secure your Azure Web App 2019
Secure your Azure Web App 2019Secure your Azure Web App 2019
Secure your Azure Web App 2019Frans Lytzen
 
Kubernetes and container security
Kubernetes and container securityKubernetes and container security
Kubernetes and container securityVolodymyr Shynkar
 
9 Writing Secure Android Applications
9 Writing Secure Android Applications9 Writing Secure Android Applications
9 Writing Secure Android ApplicationsSam Bowne
 
Hashicorp Chicago HUG - Secure and Automated Workflows in Azure with Vault an...
Hashicorp Chicago HUG - Secure and Automated Workflows in Azure with Vault an...Hashicorp Chicago HUG - Secure and Automated Workflows in Azure with Vault an...
Hashicorp Chicago HUG - Secure and Automated Workflows in Azure with Vault an...Stenio Ferreira
 
How to measure your security response readiness?
How to measure your security response readiness?How to measure your security response readiness?
How to measure your security response readiness?Tomasz Jakubowski
 
Container Days: Hijack a Kubernetes Cluster - a Walkthrough
Container Days: Hijack a Kubernetes Cluster - a WalkthroughContainer Days: Hijack a Kubernetes Cluster - a Walkthrough
Container Days: Hijack a Kubernetes Cluster - a WalkthroughNico Meisenzahl
 
Masterless Puppet Using AWS S3 Buckets and IAM Roles
Masterless Puppet Using AWS S3 Buckets and IAM RolesMasterless Puppet Using AWS S3 Buckets and IAM Roles
Masterless Puppet Using AWS S3 Buckets and IAM RolesMalcolm Duncanson, CISSP
 
Fragments-Plug the vulnerabilities in your App
Fragments-Plug the vulnerabilities in your AppFragments-Plug the vulnerabilities in your App
Fragments-Plug the vulnerabilities in your AppAppsecco
 
Security in the cloud Workshop HSTC 2014
Security in the cloud Workshop HSTC 2014Security in the cloud Workshop HSTC 2014
Security in the cloud Workshop HSTC 2014Akash Mahajan
 
Hijack a Kubernetes Cluster - a Walkthrough
Hijack a Kubernetes Cluster - a WalkthroughHijack a Kubernetes Cluster - a Walkthrough
Hijack a Kubernetes Cluster - a WalkthroughNico Meisenzahl
 
FIWARE Wednesday Webinars - How to Secure IoT Devices
FIWARE Wednesday Webinars - How to Secure IoT DevicesFIWARE Wednesday Webinars - How to Secure IoT Devices
FIWARE Wednesday Webinars - How to Secure IoT DevicesFIWARE
 
week 4_watermark.pdfffffffffffffffffffff
week 4_watermark.pdfffffffffffffffffffffweek 4_watermark.pdfffffffffffffffffffff
week 4_watermark.pdfffffffffffffffffffffanushka2002ece
 
Week 4 lecture material cc (1)
Week 4 lecture material cc (1)Week 4 lecture material cc (1)
Week 4 lecture material cc (1)Ankit Gupta
 
GraphConnect Europe 2016 - Securely Deploying Neo4j into AWS - Benjamin Nussbaum
GraphConnect Europe 2016 - Securely Deploying Neo4j into AWS - Benjamin NussbaumGraphConnect Europe 2016 - Securely Deploying Neo4j into AWS - Benjamin Nussbaum
GraphConnect Europe 2016 - Securely Deploying Neo4j into AWS - Benjamin NussbaumNeo4j
 
IT Camp 19: Top Azure security fails and how to avoid them
IT Camp 19: Top Azure security fails and how to avoid themIT Camp 19: Top Azure security fails and how to avoid them
IT Camp 19: Top Azure security fails and how to avoid themKarl Ots
 
How to write secure code
How to write secure codeHow to write secure code
How to write secure codeFlaskdata.io
 
Develop Azure compute solutions Part - 2
Develop Azure compute solutions Part - 2Develop Azure compute solutions Part - 2
Develop Azure compute solutions Part - 2AzureEzy1
 
Detecting Malicious Cloud Account Behavior: A Look at the New Native Platform...
Detecting Malicious Cloud Account Behavior: A Look at the New Native Platform...Detecting Malicious Cloud Account Behavior: A Look at the New Native Platform...
Detecting Malicious Cloud Account Behavior: A Look at the New Native Platform...Priyanka Aash
 
How to Prevent Your Kubernetes Cluster From Being Hacked
How to Prevent Your Kubernetes Cluster From Being HackedHow to Prevent Your Kubernetes Cluster From Being Hacked
How to Prevent Your Kubernetes Cluster From Being HackedNico Meisenzahl
 

Similar to Secure your web app presentation (20)

Secure your Azure Web App 2019
Secure your Azure Web App 2019Secure your Azure Web App 2019
Secure your Azure Web App 2019
 
Kubernetes and container security
Kubernetes and container securityKubernetes and container security
Kubernetes and container security
 
9 Writing Secure Android Applications
9 Writing Secure Android Applications9 Writing Secure Android Applications
9 Writing Secure Android Applications
 
Hashicorp Chicago HUG - Secure and Automated Workflows in Azure with Vault an...
Hashicorp Chicago HUG - Secure and Automated Workflows in Azure with Vault an...Hashicorp Chicago HUG - Secure and Automated Workflows in Azure with Vault an...
Hashicorp Chicago HUG - Secure and Automated Workflows in Azure with Vault an...
 
How to measure your security response readiness?
How to measure your security response readiness?How to measure your security response readiness?
How to measure your security response readiness?
 
Container Days: Hijack a Kubernetes Cluster - a Walkthrough
Container Days: Hijack a Kubernetes Cluster - a WalkthroughContainer Days: Hijack a Kubernetes Cluster - a Walkthrough
Container Days: Hijack a Kubernetes Cluster - a Walkthrough
 
Masterless Puppet Using AWS S3 Buckets and IAM Roles
Masterless Puppet Using AWS S3 Buckets and IAM RolesMasterless Puppet Using AWS S3 Buckets and IAM Roles
Masterless Puppet Using AWS S3 Buckets and IAM Roles
 
Fragments-Plug the vulnerabilities in your App
Fragments-Plug the vulnerabilities in your AppFragments-Plug the vulnerabilities in your App
Fragments-Plug the vulnerabilities in your App
 
Security in the cloud Workshop HSTC 2014
Security in the cloud Workshop HSTC 2014Security in the cloud Workshop HSTC 2014
Security in the cloud Workshop HSTC 2014
 
Hijack a Kubernetes Cluster - a Walkthrough
Hijack a Kubernetes Cluster - a WalkthroughHijack a Kubernetes Cluster - a Walkthrough
Hijack a Kubernetes Cluster - a Walkthrough
 
FIWARE Wednesday Webinars - How to Secure IoT Devices
FIWARE Wednesday Webinars - How to Secure IoT DevicesFIWARE Wednesday Webinars - How to Secure IoT Devices
FIWARE Wednesday Webinars - How to Secure IoT Devices
 
week 4_watermark.pdfffffffffffffffffffff
week 4_watermark.pdfffffffffffffffffffffweek 4_watermark.pdfffffffffffffffffffff
week 4_watermark.pdfffffffffffffffffffff
 
Week 4 lecture material cc (1)
Week 4 lecture material cc (1)Week 4 lecture material cc (1)
Week 4 lecture material cc (1)
 
GraphConnect Europe 2016 - Securely Deploying Neo4j into AWS - Benjamin Nussbaum
GraphConnect Europe 2016 - Securely Deploying Neo4j into AWS - Benjamin NussbaumGraphConnect Europe 2016 - Securely Deploying Neo4j into AWS - Benjamin Nussbaum
GraphConnect Europe 2016 - Securely Deploying Neo4j into AWS - Benjamin Nussbaum
 
IT Camp 19: Top Azure security fails and how to avoid them
IT Camp 19: Top Azure security fails and how to avoid themIT Camp 19: Top Azure security fails and how to avoid them
IT Camp 19: Top Azure security fails and how to avoid them
 
How to write secure code
How to write secure codeHow to write secure code
How to write secure code
 
Fiware cloud developers week brussels
Fiware cloud developers week brusselsFiware cloud developers week brussels
Fiware cloud developers week brussels
 
Develop Azure compute solutions Part - 2
Develop Azure compute solutions Part - 2Develop Azure compute solutions Part - 2
Develop Azure compute solutions Part - 2
 
Detecting Malicious Cloud Account Behavior: A Look at the New Native Platform...
Detecting Malicious Cloud Account Behavior: A Look at the New Native Platform...Detecting Malicious Cloud Account Behavior: A Look at the New Native Platform...
Detecting Malicious Cloud Account Behavior: A Look at the New Native Platform...
 
How to Prevent Your Kubernetes Cluster From Being Hacked
How to Prevent Your Kubernetes Cluster From Being HackedHow to Prevent Your Kubernetes Cluster From Being Hacked
How to Prevent Your Kubernetes Cluster From Being Hacked
 

Recently uploaded

Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationShrmpro
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...masabamasaba
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfayushiqss
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Hararemasabamasaba
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 

Recently uploaded (20)

Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions Presentation
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 

Secure your web app presentation

  • 1. Secure your Web App in Azure @flytzen - https://neworbit.co.uk
  • 2. Introduction Frans Lytzen, CTO NewOrbit https://www.Lytzen.name https://neworbit.pl @flytzen @flytzen - https://neworbit.co.uk
  • 3. Scope • Hosting a web app in Azure App Services • Functions are basically they same so what I say here goes for them too • There are a lot of concepts and tools – I will try to give you an overview so you can choose what is right for you • Many individual slides in this talk could fill the whole session. • I won’t – can’t – cover everything • It’s mainly infrastructure and configuration – but the few code examples are in .Net just because I use that most. @flytzen - https://neworbit.co.uk
  • 5. @flytzen - https://neworbit.co.uk Understand your exposure • Internal actors are probably a bigger threat than external actors • Usually more through stupidity than evil intent • How sensitive is your data? • How bad would it actually be for your business if all the data in your system was leaked on the internet? • How likely are you to be directly targeted? • You are always vulnerable to “drive-by” attacks • There is no such thing as 100% secure – there is only “an appropriate security level for a given risk level”
  • 7. @flytzen - https://neworbit.co.uk Concepts External Actors Internal Actors PREVENT • Secure your code – see Troy Hunt’s courses as a starting point. • Lock down your servers • Use Firewalls and Intrusion Detection/Prevention Systems • Encrypt everything in transit • Protect your passwords/secrets • Process for granting and removing access • Use Azure AD for all access, including SQL • Audit who has access on a regular basis and remove unnecessary access DETECT • Log and alert on any unusual application activity • 403s and 404s • Failed logins • High CPU/memory, increased load • Etc • Use Advanced Threat Protection • Log and alert on all access to the backend by internal users • Log and alert on unusual access patterns by application users • Consider DLP tools MITIGATE • Encrypt sensitive data at the application layer • Have ways of locking out certain users or IP addresses • For very sensitive systems, consider multi-layered architectures to contain breaches
  • 8. @flytzen - https://neworbit.co.uk Idealised Getting in Secret Management Network Isolation Encryption Detection
  • 9. Getting in @flytzen - https://neworbit.co.uk
  • 10. Make your code secure Watch Troy Hunt’s courses a starting point @flytzen - https://neworbit.co.uk
  • 11. @flytzen - https://neworbit.co.uk Can I have my own firewall? • Can I have my own firewall? • Not really, no – but you don’t need it. • Can I use a WAF (Web Application Firewall)? • Yes – if you must. • You can limit access to your web app to specific IP addresses (i.e. the WAF). • You can configure a Web App to only accept traffic from a certain vnet, but that is more for micro-services or for gateways to on-premise networks.
  • 12. @flytzen - https://neworbit.co.uk TLS/SSL • Require HTTPs for all traffic • Azure’s built-in “HTTPS Only” may interfere with “Always On” • Consider Let’s Encrypt Website Plugin for free, automated SSL Certificates. • BUT: It requires you to put powerful credentials in clear-text in the app configuration settings. • App Service Certificates allows you to buy SSL certificates from Microsoft, directly in the portal. • Remember to talk to all your back-end dependencies using TLS as well.
  • 13. ADB2C Authentication @flytzen - https://neworbit.co.uk
  • 14. ADB2C/AAD Authentication benefits • You can use Azure AD (i.e. Office 365 accounts) and/or Azure AD B2C to manage logins to your application. • ADB2C is “login as a service” that you can use for users in your application. • They both provide very powerful security features, including Multi Factor Authentication (MFA) and machine-learning based detection of suspicious logins. • Provides oAuth2 tokens for SPAs and other consumers. • Provides a sign-up flow as well (beware of 15 minute time limit) • Can integrate to other SSO providers @flytzen - https://neworbit.co.uk
  • 15. @flytzen - https://neworbit.co.uk ADB2C / AAD Authentication options Let Azure handle it all Handle it in code
  • 16. Secret management Avoid anyone being able to impersonate your application by not storing credentials in clear text @flytzen - https://neworbit.co.uk Getting in Secret Management Network Isolation Encryption Detection
  • 17. What you should achieve • Credentials for databases etc should not be stored anywhere where a developer or an ops person can get them. • Can be accidentally leaked. Password in source code, anyone? • You may not reset them when someone leaves. • Someone will use them to access the database etc – and you won’t know it was them. • Use Service Principals to authenticate to other services where possible. • Use Managed Identity so no-one “knows the password” for the application. @flytzen - https://neworbit.co.uk
  • 18. Service Principals • A Service Principal is really just an Azure AD user that is intended to be used by an application. It can have permissions and roles, just like a normal user. • Except, you have to “create an app” – which can be counter intuituve. Just embrace the weirdness. • In the portal, Azure Active Directory -> App Registration (choose Web and give it a dummy url) @flytzen - https://neworbit.co.uk
  • 19. Managed Identity • Azure will create a Service Principal for your web app. • You can get a bearer token for that Service Principal using an API running on localhost on the Web App => It can only ever be used by your web app. • In C# it’s as simple as var atp = new AzureServiceTokenProvider(); (locally, that will seamlessly use your account instead) @flytzen - https://neworbit.co.uk
  • 20. Use Azure Key Vault for Secrets • Add secrets, like Azure Storage connection strings in Azure Key Vault • Give your Web App’s Managed Identity Service Principal access to read the secrets • Add secrets to the Key Vault @flytzen - https://neworbit.co.uk
  • 21. @flytzen - https://neworbit.co.uk Retrieve secrets from Key Vault Nuget Packages: Microsoft.Azure.Services.AppAuthentication and Microsoft.Azure.KeyVault using Microsoft.Azure.Services.AppAuthentication; using Microsoft.Azure.KeyVault; // Instantiate a new KeyVaultClient object, with an access token to Key Vault var atp = new AzureServiceTokenProvider(); var kv = new KeyVaultClient(new KeyVaultClient.AuthenticationCallback(atp.KeyVault TokenCallback)); // Retrieve an individual secret called "secret" var secret = await kv.GetSecretAsync( "https://[keyvaultname].vault.azure.net/secrets/secret"); var secretValue = secret.Value; using Microsoft.Azure.Services.AppAuthentication; using Microsoft.Azure.KeyVault; var atp = new AzureServiceTokenProvider(); var kv = new KeyVaultClient(new KeyVaultClient.AuthenticationCallback(atp.KeyVaultT okenCallback)); var builder = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .AddEnvironmentVariables() .AddAzureKeyVault( "https://[keyvaultname].vault.azure.net/", kv, new DefaultKeyVaultSecretManager());; General Purpose ASP.Net Core Config Integration
  • 22. Connect to Azure SQL using Managed Identity • Add your Managed Identity Service principal as a user to the SQL Database. • It’s a bit long-winded how to do that properly so I will skip over it here. The easiest, but not best, way is to; • Create a Security Group in Azure AD • Add your Managed Identity Service Principal to that Group • Make that Group the “AD Admin” of your Azure SQL Server (not database) • Better way is to add the Service Principal as a user in SQL using T-SQL and giving it only the appropriate rights. @flytzen - https://neworbit.co.uk
  • 23. Connect to Azure SQL using Managed Identity • Remove Username and Password from your Connection String • Add a constructor like this to your DbContext: @flytzen - https://neworbit.co.uk public MyDatabaseContext(SqlConnection conn) : base(conn, true) { conn.ConnectionString = [retrieve connection string from config]; conn.AccessToken = ( new AzureServiceTokenProvider()) .GetAccessTokenAsync("https://database.windows.net/").Result; } Requires .Net 4.6 or .Net Core 2.2
  • 24. Network isolation Avoid people listening in and make it harder to attack @flytzen - https://neworbit.co.uk Getting in Secret Management Network Isolation Encryption Detection
  • 25. @flytzen - https://neworbit.co.uk Limit access to back-end services • Create a Virtual Network and a Subnet • Add Service End Points for each type of Service • Restrict access to each service to limit it to only traffic from that vNet • Allow the Web App to use that vNet • There is a performance benefit too • Note: it often takes 15-30 minutes before changes take effect!
  • 28. Encryption @flytzen - https://neworbit.co.uk Getting in Secret Management Network Isolation Encryption Detection
  • 29. @flytzen - https://neworbit.co.uk Layers • Encrypted on the wire • On by default • Check your connection strings and settings Transport Encryption • The data is encrypted on the disk • On by default for almost everything • Meaningless, but a tick in a box Encryption at Rest • Encrypt data at the application layer so even users with access to the backend can’t read it. • SQL and Storage supports it • .Net Core support is coming Application- layer encryption
  • 30. @flytzen - https://neworbit.co.uk Storage Client-side encryption• Blobs, Tables and Queues are all supported, but obviously use different setups to function. • Azure Key Vault is used to automatically manage the secrets • The Storage libraries have native support for it. • Set up Key Vault using your Managed Identity as discussed above • Items will automatically be encrypted and decrypted with rotating keys. • Even users with legitimate access to your storage account will only see encrypted data
  • 32. @flytzen - https://neworbit.co.uk SQL Always Encrypted • create, get, list, sign, verify, wrapKey, and unwrapKey Key Vault Policy permission are required. • Change your connection string to include ; Column Encryption Setting=enabled; private static void TellEFToUseKeyVaultForConnections() { var providers = new Dictionary<string, SqlColumnEncryptionKeyStoreProvider> { { SqlColumnEncryptionAzureKeyVaultProvider.ProviderName, new SqlColumnEncryptionAzureKeyVaultProvider(GetAuthToken) } }; // This is a static method SqlConnection.RegisterColumnEncryptionKeyStoreProviders(providers); } // GetAuthToken is a KeyVault callback similar to what we did for authentication earlier
  • 33. Detection How do you know you are being attacked? How do you know if your own people are accessing data they shouldn’t? @flytzen - https://neworbit.co.uk Getting in Secret Management Network Isolation Encryption Detection
  • 34. Automated alerts Machine Learning-based tools to automatically tell when something is not normal @flytzen - https://neworbit.co.uk
  • 35. Application Insights • Just switch on Application Insights and it will “baseline” your application and alert you when things are “different to normal”. • Unless hackers are very careful, they will cause disturbances as they prod your system. @flytzen - https://neworbit.co.uk
  • 36. Threat Detection • Part of SQL Advanced Data Security • In preview for Storage • Base-lines “normal” behaviour in your app and alerts you to changes. • Detects SQL injection and other common attack patterns. @flytzen - https://neworbit.co.uk
  • 37. Manual Alerts • Look for specific patterns you know are suspicious • A rise in 404s may mean someone is scanning your app to find vulnerable URLs • A rise in 403s may mean an authenticated user is trying to escalate their privileges (basically trying to access URLs they are not meant to) • A rise in failed logins may mean someone is trying to guess a username/password • You need to know when your operators read data directly from SQL @flytzen - https://neworbit.co.uk
  • 38. Alerts in Application Insights • Application Insights -> Analytics -> New Alert Rule • Create a search, tell it how often to run and when to email you. @flytzen - https://neworbit.co.uk
  • 39. Alerts in SQL • Configure SQL to write all SQL statements to Log Analytics • Create an alert that tells you each day who – other than your application – logged in. @flytzen - https://neworbit.co.uk
  • 40. SQL Advanced Data Security • Includes Threat Detection • Analyses your database to find weaknesses, such as too many users etc. • Analyses your database to find potentially sensitive data. • A fantastic tool for compliance and ongoing monitoring. @flytzen - https://neworbit.co.uk
  • 41. Closing notes @flytzen - https://neworbit.co.uk
  • 42. What Questions do you have? @flytzen - https://neworbit.co.uk

Editor's Notes

  1. About me My name is Frans Lytzen, I am CTO and co-founder of NewOrbit, a software company based near Oxford UK and right here in Rzeszow. Allow me to give you a bit of context. We have been developing systems on Azure since 2011 and we are a Microsoft Gold Partner. A lot of the systems we develop have very tight security requirements and we have been working closely with Microsoft as they have been massively increasing the tools and options you have for security in Azure.
  2. One customer of mine found that an operator was being “helpful” by emailing himself extracts of data from a highly sensitive system so they could work on some analysis at home.
  3. Most developer who think about security think about how to stop an attacker hacking your application. That is only the first step.
  4. The point is that Azure already gives you a firewall
  5. “Azure handle it” is hard to test locally and gives you less flexibility – but it is very easy. Especially helpful with oAuth2.
  6. The AppAuthentication nuget package will automatically use your identity when developing locally, as long as you are domain joined to an Azure AD. The ASP.Net Core config integration will automatically add all the secrets to your IConfiguration.
  7. We have covered a huge amount today. I think you can see that there are a lot of security tools in Azure you *can* use. I don’t think you should use them all. If Compliance is very important to you – consider choosing SQL as it has the most security and compliance features. Finally, do prioritise the monitoring and alerting side.