SlideShare una empresa de Scribd logo
1 de 15
How we made our Django app more
secure and ISO 27001 compliant
By Viren Rajput, co-founder @Earthmiles
Hacking the
university webmaster
portal for fun
Indian Express
Screenshot -
Found vulnerability
in Examination
portals exposing
answers to MCQs
ISO 27001 Framework
● Sets out the specification for an information security
management system (ISMS)
● Published by International Organization of Standardization
(ISO)
● Best-practice approach for information security
● “establish, implement, operate, monitor, review, maintain and
continually improve”
How the standard works
● Systematically examine risks
● Design & implement a suite of information security controls
● Risk treatment to address risks that are deemed unacceptable
● Adopt an overarching management process
● Ensure that security controls continue to meet the information
security needs of the organization on ongoing basis
Risk Method
Controls
A.5: Information security policies (2 controls)
A.6: Organization of information security (7 controls)
A.7: Human resource security - 6 controls that are applied before, during, or after employment
A.8: Asset management (10 controls)
A.9: Access control (14 controls)
A.10: Cryptography (2 controls)
A.11: Physical and environmental security (15 controls)
A.12: Operations security (14 controls)
A.13: Communications security (7 controls)
A.14: System acquisition, development and maintenance (13 controls)
A.15: Supplier relationships (5 controls)
A.16: Information security incident management (7 controls)
A.17: Information security aspects of business continuity management (4 controls)
A.18: Compliance; with internal requirements, such as policies, and with external requirements, such as laws (8
controls)
Fixing Authentication
- django-defender, blocks from brute forcing login attempts
- Rate limit based on IP/Username
- Reverse proxy support
- Ability to store login attempts to the database
- Admin pages to view block user names, IP, attempts
- Support for custom auth method
- Monitoring in place to raise alerts for suspicious activity by hooking
into django-defender signals
- Considered - Optional 2FA
Client Rate Limiting
- Throttle requests limit using django-rest-framework
- Different rates for user/anonymous
- Scope based throttles (analytics, uploads, profile, etc.)
Keeping secrets safe
- DynaConf - Easy and Powerful Settings Configuration for Python
- Strict separation of settings from code
- Store parameters in multiple file formats (.toml, .json, .yaml, .ini and .py).
- Sensitive secrets like tokens and passwords can be stored in safe places like
.secrets file or vault server.
- Simple feature flag system.
- Strong support for Django & Flask
Protecting the admin panel
- Change the default url from /admin to something random
- Set up a dedicated admin panel server
- Set up a dedicated OpenVPN server with a static IP
- Allotted user accounts on the OpenVPN server
- Used django-admin-ip-whitelist to restrict the staff admin panel server
access to the OpenVPN static IP
Best practices
- Use a secure Django version
- Force HTTPS with permanent redirects
- Use secure cookies, SESSION_COOKIE_SECURE and
CSRF_COOKIE_SECURE
- Handling uploads carefully (validate files they are what you expect)
- Avoiding raw queries and custom SQL
- Review dependencies, (tools like Snyk)
- Don’t leave your cache, DB, etc. exposed on a public facing machine
ISO 27001 Benefits
Thank you!
Twitter @Bkvirendra
Github @Bkvirendra

Más contenido relacionado

La actualidad más candente

Revolutionizing Advanced Threat Protection
Revolutionizing Advanced Threat ProtectionRevolutionizing Advanced Threat Protection
Revolutionizing Advanced Threat ProtectionBlue Coat
 
mod_security introduction at study2study #3
mod_security introduction at study2study #3mod_security introduction at study2study #3
mod_security introduction at study2study #3Naoya Nakazawa
 
Node JS reverse shell
Node JS reverse shellNode JS reverse shell
Node JS reverse shellMadhu Akula
 
Taking Action on Your Security Alerts with Panther and Tines
Taking Action on Your Security Alerts with Panther and Tines Taking Action on Your Security Alerts with Panther and Tines
Taking Action on Your Security Alerts with Panther and Tines Panther Labs
 
Operacionalize com alerta, dashboards customizados e linhas do tempo
Operacionalize com alerta, dashboards customizados e linhas do tempoOperacionalize com alerta, dashboards customizados e linhas do tempo
Operacionalize com alerta, dashboards customizados e linhas do tempoElasticsearch
 
Web Application Penetration
Web Application PenetrationWeb Application Penetration
Web Application PenetrationReza Rashidi
 
CAS MAA Infographic
CAS MAA InfographicCAS MAA Infographic
CAS MAA InfographicBlue Coat
 
Azure Sentinel Jan 2021 overview deck
Azure Sentinel Jan 2021 overview deck Azure Sentinel Jan 2021 overview deck
Azure Sentinel Jan 2021 overview deck Matt Soseman
 
Linux Security for Developers
Linux Security for DevelopersLinux Security for Developers
Linux Security for DevelopersMichael Boelen
 
Content Analysis System and Advanced Threat Protection
Content Analysis System and Advanced Threat ProtectionContent Analysis System and Advanced Threat Protection
Content Analysis System and Advanced Threat ProtectionBlue Coat
 
Advanced Threat Protection - Sandboxing 101
Advanced Threat Protection - Sandboxing 101Advanced Threat Protection - Sandboxing 101
Advanced Threat Protection - Sandboxing 101Blue Coat
 
Customer Story: Scaling Security With Detections-as-Code
Customer Story: Scaling Security With Detections-as-CodeCustomer Story: Scaling Security With Detections-as-Code
Customer Story: Scaling Security With Detections-as-CodePanther Labs
 
Advanced Threat Protection Lifecycle Infographic
Advanced Threat Protection Lifecycle InfographicAdvanced Threat Protection Lifecycle Infographic
Advanced Threat Protection Lifecycle InfographicBlue Coat
 
Security hardening of core AWS services
Security hardening of core AWS servicesSecurity hardening of core AWS services
Security hardening of core AWS servicesRuncy Oommen
 
Cerdant Security State of the Union
Cerdant Security State of the UnionCerdant Security State of the Union
Cerdant Security State of the UnionDavid Perkins
 
Introduction to Mod security session April 2016
Introduction to Mod security session April 2016Introduction to Mod security session April 2016
Introduction to Mod security session April 2016Rahul
 
Whats New in OSSIM v2.2?
Whats New in OSSIM v2.2?Whats New in OSSIM v2.2?
Whats New in OSSIM v2.2?AlienVault
 
Make Every Spin Count: Putting the Security Odds in Your Favor
Make Every Spin Count: Putting the Security Odds in Your FavorMake Every Spin Count: Putting the Security Odds in Your Favor
Make Every Spin Count: Putting the Security Odds in Your FavorDavid Perkins
 

La actualidad más candente (20)

Humla workshop on Android Security Testing - null Singapore
Humla workshop on Android Security Testing - null SingaporeHumla workshop on Android Security Testing - null Singapore
Humla workshop on Android Security Testing - null Singapore
 
Revolutionizing Advanced Threat Protection
Revolutionizing Advanced Threat ProtectionRevolutionizing Advanced Threat Protection
Revolutionizing Advanced Threat Protection
 
mod_security introduction at study2study #3
mod_security introduction at study2study #3mod_security introduction at study2study #3
mod_security introduction at study2study #3
 
Node JS reverse shell
Node JS reverse shellNode JS reverse shell
Node JS reverse shell
 
Taking Action on Your Security Alerts with Panther and Tines
Taking Action on Your Security Alerts with Panther and Tines Taking Action on Your Security Alerts with Panther and Tines
Taking Action on Your Security Alerts with Panther and Tines
 
Operacionalize com alerta, dashboards customizados e linhas do tempo
Operacionalize com alerta, dashboards customizados e linhas do tempoOperacionalize com alerta, dashboards customizados e linhas do tempo
Operacionalize com alerta, dashboards customizados e linhas do tempo
 
Web Application Penetration
Web Application PenetrationWeb Application Penetration
Web Application Penetration
 
CAS MAA Infographic
CAS MAA InfographicCAS MAA Infographic
CAS MAA Infographic
 
Azure Sentinel Jan 2021 overview deck
Azure Sentinel Jan 2021 overview deck Azure Sentinel Jan 2021 overview deck
Azure Sentinel Jan 2021 overview deck
 
Implementing ossec
Implementing ossecImplementing ossec
Implementing ossec
 
Linux Security for Developers
Linux Security for DevelopersLinux Security for Developers
Linux Security for Developers
 
Content Analysis System and Advanced Threat Protection
Content Analysis System and Advanced Threat ProtectionContent Analysis System and Advanced Threat Protection
Content Analysis System and Advanced Threat Protection
 
Advanced Threat Protection - Sandboxing 101
Advanced Threat Protection - Sandboxing 101Advanced Threat Protection - Sandboxing 101
Advanced Threat Protection - Sandboxing 101
 
Customer Story: Scaling Security With Detections-as-Code
Customer Story: Scaling Security With Detections-as-CodeCustomer Story: Scaling Security With Detections-as-Code
Customer Story: Scaling Security With Detections-as-Code
 
Advanced Threat Protection Lifecycle Infographic
Advanced Threat Protection Lifecycle InfographicAdvanced Threat Protection Lifecycle Infographic
Advanced Threat Protection Lifecycle Infographic
 
Security hardening of core AWS services
Security hardening of core AWS servicesSecurity hardening of core AWS services
Security hardening of core AWS services
 
Cerdant Security State of the Union
Cerdant Security State of the UnionCerdant Security State of the Union
Cerdant Security State of the Union
 
Introduction to Mod security session April 2016
Introduction to Mod security session April 2016Introduction to Mod security session April 2016
Introduction to Mod security session April 2016
 
Whats New in OSSIM v2.2?
Whats New in OSSIM v2.2?Whats New in OSSIM v2.2?
Whats New in OSSIM v2.2?
 
Make Every Spin Count: Putting the Security Odds in Your Favor
Make Every Spin Count: Putting the Security Odds in Your FavorMake Every Spin Count: Putting the Security Odds in Your Favor
Make Every Spin Count: Putting the Security Odds in Your Favor
 

Similar a ISO 27k talk for django meet up

2015 09-18-jug summer camp
2015 09-18-jug summer camp2015 09-18-jug summer camp
2015 09-18-jug summer campSebastien Gioria
 
42 minutes to secure your code....
42 minutes to secure your code....42 minutes to secure your code....
42 minutes to secure your code....Sebastien Gioria
 
Openstack security presentation 2013
Openstack security presentation 2013Openstack security presentation 2013
Openstack security presentation 2013brian_chong
 
Tips to Remediate your Vulnerability Management Program
Tips to Remediate your Vulnerability Management ProgramTips to Remediate your Vulnerability Management Program
Tips to Remediate your Vulnerability Management ProgramBeyondTrust
 
James Jara Portfolio 2014 - InfoSec White Paper- Part 5
James Jara Portfolio 2014 - InfoSec White Paper- Part 5James Jara Portfolio 2014 - InfoSec White Paper- Part 5
James Jara Portfolio 2014 - InfoSec White Paper- Part 5James Jara
 
CIA-Triad-Presentation.pdf
CIA-Triad-Presentation.pdfCIA-Triad-Presentation.pdf
CIA-Triad-Presentation.pdfBabyBoy55
 
Penetration testing dont just leave it to chance
Penetration testing dont just leave it to chancePenetration testing dont just leave it to chance
Penetration testing dont just leave it to chanceDr. Anish Cheriyan (PhD)
 
Security 101: IBM i Security Auditing and Reporting
Security 101: IBM i Security Auditing and ReportingSecurity 101: IBM i Security Auditing and Reporting
Security 101: IBM i Security Auditing and ReportingPrecisely
 
Slide Griffin - Practical Attacks and Mitigations
Slide Griffin - Practical Attacks and MitigationsSlide Griffin - Practical Attacks and Mitigations
Slide Griffin - Practical Attacks and MitigationsEnergySec
 
SCADA and HMI Security in InduSoft Web Studio
SCADA and HMI Security in InduSoft Web StudioSCADA and HMI Security in InduSoft Web Studio
SCADA and HMI Security in InduSoft Web StudioAVEVA
 
Network Implementation and Support Lesson 14 Security Features - Eric Vande...
Network Implementation and Support Lesson 14   Security Features - Eric Vande...Network Implementation and Support Lesson 14   Security Features - Eric Vande...
Network Implementation and Support Lesson 14 Security Features - Eric Vande...Eric Vanderburg
 
GOODRESUMEMSFORMINDSHIFNYADDRESS (4)
GOODRESUMEMSFORMINDSHIFNYADDRESS (4)GOODRESUMEMSFORMINDSHIFNYADDRESS (4)
GOODRESUMEMSFORMINDSHIFNYADDRESS (4)Jean Jacques
 
Anil saldhana securityassurancewithj_bosseap
Anil saldhana securityassurancewithj_bosseapAnil saldhana securityassurancewithj_bosseap
Anil saldhana securityassurancewithj_bosseapAnil Saldanha
 
Detect and Respond to Threats Better with IBM Security App Exchange Partners
Detect and Respond to Threats Better with IBM Security App Exchange PartnersDetect and Respond to Threats Better with IBM Security App Exchange Partners
Detect and Respond to Threats Better with IBM Security App Exchange PartnersIBM Security
 
CSE_Instructor_Materials_Chapter7.pptx
CSE_Instructor_Materials_Chapter7.pptxCSE_Instructor_Materials_Chapter7.pptx
CSE_Instructor_Materials_Chapter7.pptxMohammad512578
 
Guardium Data Activiy Monitor For C- Level Executives
Guardium Data Activiy Monitor For C- Level ExecutivesGuardium Data Activiy Monitor For C- Level Executives
Guardium Data Activiy Monitor For C- Level ExecutivesCamilo Fandiño Gómez
 
Operating system security
Operating system securityOperating system security
Operating system securityRamesh Ogania
 

Similar a ISO 27k talk for django meet up (20)

2015 09-18-jug summer camp
2015 09-18-jug summer camp2015 09-18-jug summer camp
2015 09-18-jug summer camp
 
42 minutes to secure your code....
42 minutes to secure your code....42 minutes to secure your code....
42 minutes to secure your code....
 
EventLog Analyzer - Product overview
EventLog Analyzer - Product overviewEventLog Analyzer - Product overview
EventLog Analyzer - Product overview
 
Openstack security presentation 2013
Openstack security presentation 2013Openstack security presentation 2013
Openstack security presentation 2013
 
Tips to Remediate your Vulnerability Management Program
Tips to Remediate your Vulnerability Management ProgramTips to Remediate your Vulnerability Management Program
Tips to Remediate your Vulnerability Management Program
 
Vulnerability Management V0.1
Vulnerability Management V0.1Vulnerability Management V0.1
Vulnerability Management V0.1
 
James Jara Portfolio 2014 - InfoSec White Paper- Part 5
James Jara Portfolio 2014 - InfoSec White Paper- Part 5James Jara Portfolio 2014 - InfoSec White Paper- Part 5
James Jara Portfolio 2014 - InfoSec White Paper- Part 5
 
CIA-Triad-Presentation.pdf
CIA-Triad-Presentation.pdfCIA-Triad-Presentation.pdf
CIA-Triad-Presentation.pdf
 
Penetration testing dont just leave it to chance
Penetration testing dont just leave it to chancePenetration testing dont just leave it to chance
Penetration testing dont just leave it to chance
 
Security 101: IBM i Security Auditing and Reporting
Security 101: IBM i Security Auditing and ReportingSecurity 101: IBM i Security Auditing and Reporting
Security 101: IBM i Security Auditing and Reporting
 
Slide Griffin - Practical Attacks and Mitigations
Slide Griffin - Practical Attacks and MitigationsSlide Griffin - Practical Attacks and Mitigations
Slide Griffin - Practical Attacks and Mitigations
 
SCADA and HMI Security in InduSoft Web Studio
SCADA and HMI Security in InduSoft Web StudioSCADA and HMI Security in InduSoft Web Studio
SCADA and HMI Security in InduSoft Web Studio
 
Network Implementation and Support Lesson 14 Security Features - Eric Vande...
Network Implementation and Support Lesson 14   Security Features - Eric Vande...Network Implementation and Support Lesson 14   Security Features - Eric Vande...
Network Implementation and Support Lesson 14 Security Features - Eric Vande...
 
IT security solutions
IT security solutionsIT security solutions
IT security solutions
 
GOODRESUMEMSFORMINDSHIFNYADDRESS (4)
GOODRESUMEMSFORMINDSHIFNYADDRESS (4)GOODRESUMEMSFORMINDSHIFNYADDRESS (4)
GOODRESUMEMSFORMINDSHIFNYADDRESS (4)
 
Anil saldhana securityassurancewithj_bosseap
Anil saldhana securityassurancewithj_bosseapAnil saldhana securityassurancewithj_bosseap
Anil saldhana securityassurancewithj_bosseap
 
Detect and Respond to Threats Better with IBM Security App Exchange Partners
Detect and Respond to Threats Better with IBM Security App Exchange PartnersDetect and Respond to Threats Better with IBM Security App Exchange Partners
Detect and Respond to Threats Better with IBM Security App Exchange Partners
 
CSE_Instructor_Materials_Chapter7.pptx
CSE_Instructor_Materials_Chapter7.pptxCSE_Instructor_Materials_Chapter7.pptx
CSE_Instructor_Materials_Chapter7.pptx
 
Guardium Data Activiy Monitor For C- Level Executives
Guardium Data Activiy Monitor For C- Level ExecutivesGuardium Data Activiy Monitor For C- Level Executives
Guardium Data Activiy Monitor For C- Level Executives
 
Operating system security
Operating system securityOperating system security
Operating system security
 

Último

Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 

Último (20)

Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 

ISO 27k talk for django meet up

  • 1. How we made our Django app more secure and ISO 27001 compliant By Viren Rajput, co-founder @Earthmiles
  • 2. Hacking the university webmaster portal for fun Indian Express Screenshot -
  • 4. ISO 27001 Framework ● Sets out the specification for an information security management system (ISMS) ● Published by International Organization of Standardization (ISO) ● Best-practice approach for information security ● “establish, implement, operate, monitor, review, maintain and continually improve”
  • 5. How the standard works ● Systematically examine risks ● Design & implement a suite of information security controls ● Risk treatment to address risks that are deemed unacceptable ● Adopt an overarching management process ● Ensure that security controls continue to meet the information security needs of the organization on ongoing basis
  • 7. Controls A.5: Information security policies (2 controls) A.6: Organization of information security (7 controls) A.7: Human resource security - 6 controls that are applied before, during, or after employment A.8: Asset management (10 controls) A.9: Access control (14 controls) A.10: Cryptography (2 controls) A.11: Physical and environmental security (15 controls) A.12: Operations security (14 controls) A.13: Communications security (7 controls) A.14: System acquisition, development and maintenance (13 controls) A.15: Supplier relationships (5 controls) A.16: Information security incident management (7 controls) A.17: Information security aspects of business continuity management (4 controls) A.18: Compliance; with internal requirements, such as policies, and with external requirements, such as laws (8 controls)
  • 8.
  • 9. Fixing Authentication - django-defender, blocks from brute forcing login attempts - Rate limit based on IP/Username - Reverse proxy support - Ability to store login attempts to the database - Admin pages to view block user names, IP, attempts - Support for custom auth method - Monitoring in place to raise alerts for suspicious activity by hooking into django-defender signals - Considered - Optional 2FA
  • 10. Client Rate Limiting - Throttle requests limit using django-rest-framework - Different rates for user/anonymous - Scope based throttles (analytics, uploads, profile, etc.)
  • 11. Keeping secrets safe - DynaConf - Easy and Powerful Settings Configuration for Python - Strict separation of settings from code - Store parameters in multiple file formats (.toml, .json, .yaml, .ini and .py). - Sensitive secrets like tokens and passwords can be stored in safe places like .secrets file or vault server. - Simple feature flag system. - Strong support for Django & Flask
  • 12. Protecting the admin panel - Change the default url from /admin to something random - Set up a dedicated admin panel server - Set up a dedicated OpenVPN server with a static IP - Allotted user accounts on the OpenVPN server - Used django-admin-ip-whitelist to restrict the staff admin panel server access to the OpenVPN static IP
  • 13. Best practices - Use a secure Django version - Force HTTPS with permanent redirects - Use secure cookies, SESSION_COOKIE_SECURE and CSRF_COOKIE_SECURE - Handling uploads carefully (validate files they are what you expect) - Avoiding raw queries and custom SQL - Review dependencies, (tools like Snyk) - Don’t leave your cache, DB, etc. exposed on a public facing machine

Notas del editor

  1. I am Viren, I work on Earthmiles where I essentially do full stack development with Django/React/React Native. Earthmiles provides a comprehensive wellbeing engagement platform designed to motivate health living. It is mobile only for users, with gamified features and a variety of behavioral psychological levers. In this talk, will be talking about some of the stuff we carried out to make our Django web app compliant to the ISO 27001 (framework for information security systems). You need not necessarily need to join it for ISO as I will take you through the core bits needed to understand its importance in order to be more relevant. The generic security bits here should be applicable to most Django apps that are in production. Being a SAAS product and selling to large corporate clients we found ourselves needing to get this certification Django is as secure as any web framework can be. It provides tools and doc guidelines to prevent common mistakes causing security problems (csrf, xss, etc.) However, a tool in itself cannot be "secure". The whole platform security depends on the proper use of the tools you choose, and thus is more a matter of developer skills. No matter the size of your company or what industry you work in, gaining ISO 27001 certification can be a huge win. However, it is a challenging task so it’s important to leverage other stakeholders and resources during a compliance project.
  2. To give you an idea of where i am coming, I am in no way a security expert but have had a fair share of fun hacking on systems mostly to test my skills. While at university i managed to get into their university servers with a sql injection. This is a screenshot from the local newspaper that covered the story about a kid hacking into systems.
  3. This exploit was crucial because the portal was being utilised for online semester exams. And it could be exploited using just chrome and the network inspector, deeply nested JSON payload had the answers. I sent them a video evidence of the bug to get their attention. These are just some examples of rather poor information security implementation on the side of these organizations that they could be so easily exploited by a 1st / 2nd year student.
  4. ISO/IEC 27001:2013 is the international standard that sets out the specification for an information security management system (ISMS). Its best-practice approach helps organisations manage their information security by addressing people and processes as well as technology. ISO 27001 is a framework that helps organisations “establish, implement, operate, monitor, review, maintain and continually improve an ISMS”. The CIA triad (also called CIA triangle) is a guide for measures in information security. Information security influences how information technology is used. The CIA security triangle shows the fundamental goals that must be included in information security measures Confidentiality is the protection of information from unauthorized access. This goal of the CIA triad emphasizes the need for information protection.Confidentiality requires measures to ensure that only authorized people are allowed to access the information. The CIA triad goal of integrity is the condition where information is kept accurate and consistent unless authorized changes are made. It is possible for information to change because of careless access and use, errors in the information system, or unauthorized access and use. The CIA triad goal of availability is the situation where information is available when and where it is rightly needed. The main concern in the CIA triad is that the information should be available when authorized users need to access it. Availability is maintained when all components of the information system are working properly.
  5. Most organizations have a number of information security controls. However, without an information security management system (ISMS), controls tend to be somewhat disorganized and disjointed, having been implemented often as point solutions to specific situations or simply as a matter of convention. ISO/IEC 27001 requires that management: Systematically examine the organization's information security risks, taking account of the threats, vulnerabilities, and impacts; Design and implement a coherent and comprehensive suite of information security controls and/or other forms of risk treatment (such as risk avoidance or risk transfer) to address those risks that are deemed unacceptable; and Adopt an overarching management process to ensure that the information security controls continue to meet the organization's information security needs on an ongoing basis. Note that ISO/IEC 27001 is designed to cover much more than just IT. An ISMS may be certified compliant with ISO/IEC 27001 by a number of Accredited Registrars worldwide upon successful completion of the audit.
  6. Key key assets are identified using a brain storming session and are grouped where appropriate The risk acceptance criteria be set at a Risk Level of 2, on a range of Risk Level 1 (lowest) to Risk Level 5 (highest). The risk algorithm chosen is R = I + L - 1. The impact of each key asset being compromised will be estimated using the following matrix, defaulting to the highest level across the 3 parameters
  7. This describes how an organization can respond to risks with a risk treatment plan; an important part of this is choosing appropriate controls. This is because it provides an essential tool for managing information security risks: a list of security controls (or safeguards) that are to be used to improve the security of information assets. There are 114 controls in 14 groups and 35 control categories: A.5 Information security policies – controls on how the policies are written and reviewed A.6 Organization of information security – controls on how the responsibilities are assigned; also includes the controls for mobile devices and teleworking A.7 Human resources security – controls prior to employment, during, and after the employment A.8 Asset management – controls related to inventory of assets and acceptable use; also for information classification and media handling A.9 Access control – controls for the management of access rights of users, systems and applications, and for the management of user responsibilities A.10 Cryptography – controls related to encryption and key management A.11 Physical and environmental security – controls defining secure areas, entry controls, protection against threats, equipment security, secure disposal, Clear Desk and Clear Screen Policy, etc. A.12 Operational security – lots of controls related to the management of IT production: change management, capacity management, malware, backup, logging, monitoring, installation, vulnerabilities, etc. A.13 Communications security – controls related to network security, segregation, network services, transfer of information, messaging, etc. A.14 System acquisition, development and maintenance – controls defining security requirements, and security in development and support processes A.15 Supplier relationships – controls on what to include in agreements, and how to monitor the suppliers A.16 Information security incident management – controls for reporting events and weaknesses, defining responsibilities, response procedures, and collection of evidence A.17 Information security aspects of business continuity management – controls requiring the planning of business continuity, procedures, verification and reviewing, and IT redundancy A.18 Compliance – controls requiring the identification of applicable laws and regulations, intellectual property protection, personal data protection, and reviews of information security
  8. These have become increasingly common and frequent. Just the last week, a new DB with more than 3.2 billion unique pairs of cleartext emails and passwords have just been leaked on a popular public hacking forum, aggregating past leaks from Netflix, LinkedIn and more. This leak is comparable to the Breach Compilation of 2017, in which 1.4 billion credentials were leaked. The current breach, known as “Compilation of Many Breaches” (COMB), contains more than double the unique email and password pairs. The impact to consumers and businesses of this new breach may be unprecedented. Because the majority of people reuse their passwords and usernames across multiple accounts, credential stuffing attacks is the biggest threat.
  9. Django provides a lot of security features baked in, but the authentication system does not inherently protect against brute force attacks. Scenario: Credential stuffing, the use of lists of known passwords, is a common attack. Applications that do not implement automated threat or credential stuffing protections, the application can be used as a password oracle to determine if the credentials are valid. Something we have faced a couple of times in the past. Attackers using random IPs throughout the world to bombard us with login requests that contained stolen email/passwords We tackled this by implementing a combination of several things to target this risk Django-defender A simple Django reusable app that blocks people from brute forcing login attempts. It makes this as fast as possible, so that we do not slow down the login attempts. How django-defender works When someone tries to login, it will first check to see if they are currently blocked. Checking the username they are trying to use, as well as the IP address. If they are blocked, goto step 5. If not blocked go to step 2 2. They are not blocked, so we check to see if the login was valid. If valid go to step 6. If not valid go to step 3. Login attempt wasn't valid. Add their username and IP address for this attempt to the cache. If this brings them over the limit, add them to the blocked list, and then goto step 5. If not over the limit goto step 4. Login was invalid, but not over the limit. Send them back to the login screen to try again. 5. User is blocked: Send them to the blocked page, telling them they are blocked, and give an estimate on when they will be unblocked. 6. Login is valid. Reset any failed login attempts, and forward to their destination.
  10. Performance isn’t the only reason to limit API requests, either. API limiting, which is also known as rate limiting, is an essential component of Internet security, as DoS attacks can tank a server with unlimited API requests. Rate limiting also helps make your API scalable. If your API blows up in popularity, there can be unexpected spikes in traffic, causing severe lag time. Throttling is similar to permissions, in that it determines if a request should be authorized. Throttles indicate a temporary state, and are used to control the rate of requests that clients can make to an API. As with permissions, multiple throttles may be used. Your API might have a restrictive throttle for unauthenticated requests, and a less restrictive throttle for authenticated requests. The X-Forwarded-For HTTP header and REMOTE_ADDR WSGI variable are used to uniquely identify client IP addresses for throttling. If the X-Forwarded-For header is present then it will be used, otherwise the value of the REMOTE_ADDR variable from the WSGI environment will be used. The AnonRateThrottle will only ever throttle unauthenticated users. The IP address of the incoming request is used to generate a unique key to throttle against. The UserRateThrottle will throttle users to a given rate of requests across the API. The user id is used to generate a unique key to throttle against. Unauthenticated requests will fall back to using the IP address of the incoming request to generate a unique key to throttle against. UserRateThrottle is suitable if you want simple global rate restrictions per-user. The ScopedRateThrottle class can be used to restrict access to specific parts of the API. This throttle will only be applied if the view that is being accessed includes a .throttle_scope property. The unique throttle key will then be formed by concatenating the "scope" of the request with the unique user id or IP address.
  11. Use a private repository if your project is sensitive. But its never a good practice to check your secrets into version control, even if you are using a private repository. This is a fairly common issue., for years, developers have been mistakenly publishing credentials that grant access to myriad systems, such as databases, web hosting accounts, encrypted email, slack bots and various apps. It’s an easy mistake to make that can lead to catastrophic breaches, particularly when the credentials can unlock systems that are crucial to business functions. Apps sometimes store config as constants in the code. This is a violation of twelve-factor, which requires strict separation of config from code. Config varies substantially across deploys, code does not. A litmus test for whether an app has all config correctly factored out of the code is whether the codebase could be made open source at any moment, without compromising any credentials. dynaconf a layered configuration system for Python applications - with strong support for 12-factor applications and extensions for Flask and Django. Strict separation of settings from code (following 12-factor applications Guide). Define comprehensive default values. Store parameters in multiple file formats (.toml, .json, .yaml, .ini and .py). Sensitive secrets like tokens and passwords can be stored in safe places like .secrets file or vault server. Parameters can optionally be stored in external services like Redis server. Feature flagging is a system to dynamically toggle features in your application based in some settings value.The advantage of using it is to perform changes on the fly without the need to redeploy ou restart the application.
  12. In our ISO Risk Methodology Admin panel is defined as a key key asset Admin panel is a very high risk as it would affect the parts CIA trial altogether if compromised Adding extra layer of security using django-admin-ip-whitelist is a Django middleware app to ban users whose IPs are not whitelisted. Stores whole 'whitelist' in memory to avoid database lookups on every request. Allowed access to internal only services, staging servers, test servers using the OpenVPN server only
  13. As Django is regularly patched with latest security updates. Using an up-to-date LTS Django version would ensure that the application has all the latest security patches. It is always preferable to deploy behind HTTPS. Doing so prevents malicious users from intercepting information sent between the client and the server. The default cookie behavior is to connect over http. However, since we already established that you need to use https, you want to make sure your cookies are only being sent over https as well. To prevent leaking cookies, be sure to set your SESSION_COOKIE_SECURE and CSRF_COOKIE_SECURE settings to True If your web application allows users to upload files, you are opening yourself to an attack vector and the upload logic should therefore be handled carefully. It is important to validate all uploaded files to be sure they are what you expect While it may be tempting to write raw sql queries and custom SQL, doing so may open the door for an attack. A user attempting to perform an sql injection (execute arbitrary sql on a database) is going to find it much harder, if you always use the ORM. Organizations usually assume most risks come from public-facing web applications. That has changed. With dozens of small components in every application, risks can come from anywhere in the codebase. While bugs like Heartbleed, ShellShock, and the DROWN attack made headlines that were too big to ignore, most bugs found in dependencies often go unnoticed. Indirect dependencies are as likely to introduce risk as direct dependencies, but these risks are less likely to be recognized. Tool like Snyk helps you understand your entire dependency tree.
  14. ISO 27k made us rethink a lot about our security as a whole. And enabled us to implement the best practices in regards to keeping the information safe and secure. ISO 27001 is one of the most popular information security standards in existence. Independently accredited certification to the Standard is recognised around the world and the number of certifications has grown by more than 450% in the past ten years.
  15. Today, Tuesday, 9 February 2021, we celebrate the 18th edition of Safer Internet Day with actions taking place right across the globe. With a theme once again of "Together for a better internet", this day calls upon all stakeholders to join together to make the internet a safer and better place for all, As a representative of an organisation and industry, you are in a direct position to design, shape and adapt the platforms, services and content children and young people interact with on a daily basis. In doing so, you have the power to make a safer and better internet a concrete reality.