SlideShare a Scribd company logo
Application Security
Daily questions & answers
Sergey Belov
Head of Application Security
Mail.Ru Group
$ whoami
● Head of Application Security @ Mail.Ru Group
● Fan of web security
● https://sergeybelove.ru
Agenda
➔ Download file by a link
➔ Secret keys
➔ Temporary tokens
➔ 3rd party websites on the main domain
➔ 3rd party monitorings and sensitive data
➔ Push notifications vs SMS
➔ FFmpeg / ImageMagick
➔ Serving user content
➔ Crypto
Download file by a link
Jira task:
Allow users to download files by a link
Developer:
<?php
file_get_contents($_POST['url']);
?>
Hacker:
url = file:///etc/passwd
url = http://10.0.0.2
Download file by a link and SSRF
What we should to check?
1. Scheme - http/https
2. destination_ip - not in local network / not in trusted zone
3. Check URL after redirections
4. destination_port (allows 80/443)
5. Race Condition
- Resolving (IP is external - OK)
- Trying to download file - new DNS resolve (!)
- In step above attacker can respond with internal IP
Solution: do only one resolve and pass this IP to http lib
1. Vulnerabilities of HTTP libraries (such as cURL)
2. IPv6
3. …
4. Create server in external network with API for such tasks
5. 2 network links - 1st for external and file downloading / 2nd for administration
6. You can be inspired by - https://github.com/fin1te/safecurl
Download file by a link and SSRF
Secrets keys
Secret keys
● Keys for signing stateless things (sessions)
● Secret for crypto functions, anti-CSRF / password reset tokens etc
● Credentials for connecting to external API/Databases
● login:password for trackers / analytics
● Initialization vectors
● ...
One main rule - do not hardcode them!
Move them to config files / deploy via Puppet Hiera-Eyaml
Temporary tokens
Temporary tokens
Examples
● Password remind
● Leave feedback
● Confirm action
● ...
Threats
● access_log and incorrect ACL (developers can read it?)
● Email forwarding
● Browser history
These tokens:
● Should not start “real” session (like after login)
● Their lifetime is minimal and usually depends on business purposes (from minutes to months)
● Bind to the parameters for this action (order id, user, action)
Temporary tokens
3rd party websites on the main domain
3rd party websites on the main domain
Business want:
● Promo sites
● Sites with vacancies, blogs
● Sites from outsources
● Support / ticket systems
● Custom projects
● etc
Could be opened at: http://example.com/projectname
What people do?
● Hosting on the same server
● proxy_pass + nginx
How to implement it secure?
● Same top header for all pages and <iframe sandbox … > without allow-top-navigation + CSP
● Share user’s data with postMessage
3rd party websites on the main domain
3rd party monitorings and sensitive data
Pages:
- Password change
- Credit card linking
- Account recovery
- 2 step auth handling
- And other important pages
Should not (not recommended) contain external trackers / analytics / any other statics (pictures, styles,
etc.) from domains that do not belong to the company
3rd party monitorings and sensitive data
Push notification vs SMS
Interception of SMS:
● Attacks via SS7 (completely remotely)
● Targeted interception of SMS (you need to be physically near)
● Through IVR Spoofing (the success of an attack depends on the operator) in case the code is
delivered instead of SMS by a call
● Malware
● Re-issue of SIM cards
● Work of special services
Interception of Push Notifications:
● Vulnerabilities of Google / Apple / Microsoft
● Incorrect push subscription mechanism (backend problems - set the ID of your device and the victim
user ID)
● It is possible to intercept through the privileged applications (for example, to transfer the push on the
smart watches, to the multimedia system of the cars, etc.)
Push notification vs SMS
How to switch from SMS to push notifications:
1) The first confirmation is via SMS. Here you can get device_id for push notifications
2) In push notifications do not transfer the secret data (the confirmation code) visually, do it in payload.
The application itself will pull out and substitute this code for the action.
3) Test security of subscription API
Push notification vs SMS
FFmpeg / ImageMagick
You are using FFmpeg? ImageMagick?
Consider that any user can read any files on the server /
execute any OS commands
Attacks on video converters: a year later - https://www.phdays.ru/program/213682/
(Emil Lerner and Pavel Cheryomushkin)
FFmpeg / ImageMagick
FFmpeg / ImageMagick
In case if need it:
- Do sandboxing (docker / SELinux / etc)
- Deploy it in an isolated network
- Create REST API
- Disable everything that you don’t need (like demuxers - HLS)
Serving user content
Few rules
1) Serve from another domain (* .example-content-from-users.com)
2) Disable interpreters on the backend
3) If the file is private (attachment) - generate a temporary token and is check it when it is opened (for
example, through nginx + LUA)
Serving user content
Crypto
Crypto
Do not implement your own cryptography
even if it seems right to you
Do not know what to choose?
● Take your case
● Choose a popular framework / CMS (WP / Django / RoR)
● See how it's done there
Crypto
Rate limits
Your methods should support:
1) The ability to restrict API calls to methods (by user with time shift)
2) Have the ability to monitor how many times a method is invoked (allows you to detect mass attacks)
3) Implement several rate limit methods: absolute (for example, 5 times a minute), after confirmation
(after entering the captcha)
Rate limits
@sergeybelove
s.belov@corp.mail.ru

More Related Content

What's hot (20)

PDF
[OWASP Poland Day] Web App Security Architectures
OWASP
 
PPTX
[Wroclaw #2] iOS Security - 101
OWASP
 
PDF
Android Tamer (Anant Shrivastava)
ClubHack
 
PDF
Owasp Mobile Risk M2 : Insecure Data Storage : null/OWASP/G4H Bangalore Aug 2014
Anant Shrivastava
 
PDF
[Wroclaw #6] Introduction to desktop browser add-ons
OWASP
 
PDF
Security Issues in Android Custom ROM
Anant Shrivastava
 
PPTX
[Wroclaw #5] OWASP Projects: beyond Top 10
OWASP
 
PPTX
Practice of AppSec .NET
Mikhail Shcherbakov
 
PPTX
Rapid Android Application Security Testing
Nutan Kumar Panda
 
PDF
Testing Android Security Codemotion Amsterdam edition
Jose Manuel Ortega Candel
 
PPT
Implementing application security using the .net framework
Lalit Kale
 
PDF
Content Security Policy - Lessons learned at Yahoo
Binu Ramakrishnan
 
PDF
A Scalable Client Authentication & Authorization Service for Container-Based ...
Binu Ramakrishnan
 
PDF
Browser Exploit Framework
n|u - The Open Security Community
 
PDF
How to secure web applications
Mohammed A. Imran
 
PDF
I got 99 trends and a # is all of them
Roberto Suggi Liverani
 
PDF
Android security and penetration testing | DIVA | Yogesh Ojha
Yogesh Ojha
 
ODP
Csrf not-all-defenses-are-created-equal
drewz lin
 
PPTX
Owasp for testing_mobile_apps_opd
Pawel Rzepa
 
[OWASP Poland Day] Web App Security Architectures
OWASP
 
[Wroclaw #2] iOS Security - 101
OWASP
 
Android Tamer (Anant Shrivastava)
ClubHack
 
Owasp Mobile Risk M2 : Insecure Data Storage : null/OWASP/G4H Bangalore Aug 2014
Anant Shrivastava
 
[Wroclaw #6] Introduction to desktop browser add-ons
OWASP
 
Security Issues in Android Custom ROM
Anant Shrivastava
 
[Wroclaw #5] OWASP Projects: beyond Top 10
OWASP
 
Practice of AppSec .NET
Mikhail Shcherbakov
 
Rapid Android Application Security Testing
Nutan Kumar Panda
 
Testing Android Security Codemotion Amsterdam edition
Jose Manuel Ortega Candel
 
Implementing application security using the .net framework
Lalit Kale
 
Content Security Policy - Lessons learned at Yahoo
Binu Ramakrishnan
 
A Scalable Client Authentication & Authorization Service for Container-Based ...
Binu Ramakrishnan
 
Browser Exploit Framework
n|u - The Open Security Community
 
How to secure web applications
Mohammed A. Imran
 
I got 99 trends and a # is all of them
Roberto Suggi Liverani
 
Android security and penetration testing | DIVA | Yogesh Ojha
Yogesh Ojha
 
Csrf not-all-defenses-are-created-equal
drewz lin
 
Owasp for testing_mobile_apps_opd
Pawel Rzepa
 

Similar to [OWASP Poland Day] Application security - daily questions & answers (20)

ODP
CISSP Week 14
jemtallon
 
PPTX
Secure Android Development
Shaul Rosenzwieg
 
PDF
Introduction to Web Application Security - Blackhoodie US 2018
Niranjanaa Ragupathy
 
PPTX
PPT ON CYBER SECURITY FRAMEWORK & CYBER AUDITING IN CRPF .pptx
hcrosdr
 
PDF
Single Sign-on Framework in Tizen
Ryo Jin
 
PPTX
Secure programming with php
Mohmad Feroz
 
PDF
James Jara Portfolio 2014 - InfoSec White Paper- Part 5
James Jara
 
PPTX
Flipping the script
Chris Nickerson
 
PPTX
6 - Web Application Security.pptx
AlmaOraevi
 
PDF
Ron Munitz - The Ultimate Android Security Checklist - Codemotion Rome 2015
Codemotion
 
PDF
IT Essentials (Version 7.0) - ITE Chapter 13 Exam Answers
ITExamAnswers.net
 
PDF
Real life hacking101
Florent Batard
 
PDF
The Ultimate Android Security Checklist (Codemotion Tel-Aviv, 2014)
Ron Munitz
 
PDF
Remote security with Red Hat Enterprise Linux
Giuseppe Paterno'
 
ODP
Cracking Into Embedded Devices - HACK.LU 2K8
guest441c58b71
 
PDF
API Upload Test
decatv
 
PDF
API Upload Test
decatv
 
PDF
API Upload Test
decatv
 
PDF
API Upload Test
decatv
 
PDF
API Upload Test
decatv
 
CISSP Week 14
jemtallon
 
Secure Android Development
Shaul Rosenzwieg
 
Introduction to Web Application Security - Blackhoodie US 2018
Niranjanaa Ragupathy
 
PPT ON CYBER SECURITY FRAMEWORK & CYBER AUDITING IN CRPF .pptx
hcrosdr
 
Single Sign-on Framework in Tizen
Ryo Jin
 
Secure programming with php
Mohmad Feroz
 
James Jara Portfolio 2014 - InfoSec White Paper- Part 5
James Jara
 
Flipping the script
Chris Nickerson
 
6 - Web Application Security.pptx
AlmaOraevi
 
Ron Munitz - The Ultimate Android Security Checklist - Codemotion Rome 2015
Codemotion
 
IT Essentials (Version 7.0) - ITE Chapter 13 Exam Answers
ITExamAnswers.net
 
Real life hacking101
Florent Batard
 
The Ultimate Android Security Checklist (Codemotion Tel-Aviv, 2014)
Ron Munitz
 
Remote security with Red Hat Enterprise Linux
Giuseppe Paterno'
 
Cracking Into Embedded Devices - HACK.LU 2K8
guest441c58b71
 
API Upload Test
decatv
 
API Upload Test
decatv
 
API Upload Test
decatv
 
API Upload Test
decatv
 
API Upload Test
decatv
 
Ad

More from OWASP (20)

PDF
[OPD 2019] Web Apps vs Blockchain dApps
OWASP
 
PDF
[OPD 2019] Threat modeling at scale
OWASP
 
PDF
[OPD 2019] Life after pentest
OWASP
 
PDF
[OPD 2019] .NET Core Security
OWASP
 
PDF
[OPD 2019] Top 10 Security Facts of 2020
OWASP
 
PDF
[OPD 2019] Governance as a missing part of IT security architecture
OWASP
 
PDF
[OPD 2019] Storm Busters: Auditing & Securing AWS Infrastructure
OWASP
 
PPTX
[OPD 2019] Side-Channels on the Web:
Attacks and Defenses
OWASP
 
PPTX
[OPD 2019] AST Platform and the importance of multi-layered application secu...
OWASP
 
PPTX
[OPD 2019] Inter-application vulnerabilities
OWASP
 
PDF
[OPD 2019] Automated Defense with Serverless computing
OWASP
 
PDF
[OPD 2019] Advanced Data Analysis in RegSOC
OWASP
 
PDF
[OPD 2019] Attacking JWT tokens
OWASP
 
PDF
[OPD 2019] Rumpkernels meet fuzzing
OWASP
 
PDF
[OPD 2019] Trusted types and the end of DOM XSS
OWASP
 
PDF
[Wroclaw #9] The purge - dealing with secrets in Opera Software
OWASP
 
PDF
[Wroclaw #9] To be or Not To Be - Threat Modeling in Security World
OWASP
 
PDF
OWASP Poland 13 November 2018 - Martin Knobloch - Building Secure Software
OWASP
 
PDF
OWASP Poland Day 2018 - Amir Shladovsky - Crypto-mining
OWASP
 
PDF
OWASP Poland Day 2018 - Damian Rusinek - Outsmarting smart contracts
OWASP
 
[OPD 2019] Web Apps vs Blockchain dApps
OWASP
 
[OPD 2019] Threat modeling at scale
OWASP
 
[OPD 2019] Life after pentest
OWASP
 
[OPD 2019] .NET Core Security
OWASP
 
[OPD 2019] Top 10 Security Facts of 2020
OWASP
 
[OPD 2019] Governance as a missing part of IT security architecture
OWASP
 
[OPD 2019] Storm Busters: Auditing & Securing AWS Infrastructure
OWASP
 
[OPD 2019] Side-Channels on the Web:
Attacks and Defenses
OWASP
 
[OPD 2019] AST Platform and the importance of multi-layered application secu...
OWASP
 
[OPD 2019] Inter-application vulnerabilities
OWASP
 
[OPD 2019] Automated Defense with Serverless computing
OWASP
 
[OPD 2019] Advanced Data Analysis in RegSOC
OWASP
 
[OPD 2019] Attacking JWT tokens
OWASP
 
[OPD 2019] Rumpkernels meet fuzzing
OWASP
 
[OPD 2019] Trusted types and the end of DOM XSS
OWASP
 
[Wroclaw #9] The purge - dealing with secrets in Opera Software
OWASP
 
[Wroclaw #9] To be or Not To Be - Threat Modeling in Security World
OWASP
 
OWASP Poland 13 November 2018 - Martin Knobloch - Building Secure Software
OWASP
 
OWASP Poland Day 2018 - Amir Shladovsky - Crypto-mining
OWASP
 
OWASP Poland Day 2018 - Damian Rusinek - Outsmarting smart contracts
OWASP
 
Ad

Recently uploaded (20)

PDF
Digital burnout toolkit for youth workers and teachers
asociatiastart123
 
PDF
FutureCon Seattle 2025 Presentation Slides - You Had One Job
Suzanne Aldrich
 
PPTX
Introduction-to-the-AWS-Solution-Architect.pptx
Prince391830
 
PDF
The Hidden Benefits of Outsourcing IT Hardware Procurement for Small Businesses
Carley Cramer
 
PPTX
原版一样(毕业证书)法国蒙彼利埃大学毕业证文凭复刻
Taqyea
 
PPTX
Class_4_Limbgvchgchgchgchgchgcjhgchgcnked_Lists.pptx
test123n
 
PPTX
PHIPA-Compliant Web Hosting in Toronto: What Healthcare Providers Must Know
steve198109
 
PPTX
Ransomware attack and its effects on cyber crimes
ShilpaShreeD
 
PDF
Empowering Local Language Email with IDN & EAI – Powered by XgenPlus
XgenPlus Technologies
 
PPTX
My Mother At 66! (2).pptx00000000000000000000000000000
vedapattisiddharth
 
PDF
google promotion services in Delhi, India
Digital Web Future
 
PDF
web application development company in bangalore.pdf
https://dkpractice.co.in/seo.html tech
 
PPTX
Meloniusk_Communication_Template_best.pptx
howesix147
 
PPTX
Lesson 1.1 Career-Opportunities-in-Ict.pptx
lizelgumadlas1
 
PDF
Beginning-Laravel-Build-Websites-with-Laravel-5.8-by-Sanjib-Sinha-z-lib.org.pdf
TagumLibuganonRiverB
 
PPTX
美国电子毕业证帕克大学电子版成绩单UMCP学费发票办理学历认证
Taqyea
 
PPTX
Metaphysics_Presentation_With_Visuals.pptx
erikjohnsales1
 
PPTX
CHAPTER 1 - PART 3 FOR GRADE 11 STUDENTS
FSBTLEDNathanVince
 
PDF
Strategic Plan New and Completed Templeted
alvi932317
 
PDF
BRKSP-2551 - Introduction to Segment Routing.pdf
fcesargonca
 
Digital burnout toolkit for youth workers and teachers
asociatiastart123
 
FutureCon Seattle 2025 Presentation Slides - You Had One Job
Suzanne Aldrich
 
Introduction-to-the-AWS-Solution-Architect.pptx
Prince391830
 
The Hidden Benefits of Outsourcing IT Hardware Procurement for Small Businesses
Carley Cramer
 
原版一样(毕业证书)法国蒙彼利埃大学毕业证文凭复刻
Taqyea
 
Class_4_Limbgvchgchgchgchgchgcjhgchgcnked_Lists.pptx
test123n
 
PHIPA-Compliant Web Hosting in Toronto: What Healthcare Providers Must Know
steve198109
 
Ransomware attack and its effects on cyber crimes
ShilpaShreeD
 
Empowering Local Language Email with IDN & EAI – Powered by XgenPlus
XgenPlus Technologies
 
My Mother At 66! (2).pptx00000000000000000000000000000
vedapattisiddharth
 
google promotion services in Delhi, India
Digital Web Future
 
web application development company in bangalore.pdf
https://dkpractice.co.in/seo.html tech
 
Meloniusk_Communication_Template_best.pptx
howesix147
 
Lesson 1.1 Career-Opportunities-in-Ict.pptx
lizelgumadlas1
 
Beginning-Laravel-Build-Websites-with-Laravel-5.8-by-Sanjib-Sinha-z-lib.org.pdf
TagumLibuganonRiverB
 
美国电子毕业证帕克大学电子版成绩单UMCP学费发票办理学历认证
Taqyea
 
Metaphysics_Presentation_With_Visuals.pptx
erikjohnsales1
 
CHAPTER 1 - PART 3 FOR GRADE 11 STUDENTS
FSBTLEDNathanVince
 
Strategic Plan New and Completed Templeted
alvi932317
 
BRKSP-2551 - Introduction to Segment Routing.pdf
fcesargonca
 

[OWASP Poland Day] Application security - daily questions & answers

  • 1. Application Security Daily questions & answers Sergey Belov Head of Application Security Mail.Ru Group
  • 2. $ whoami ● Head of Application Security @ Mail.Ru Group ● Fan of web security ● https://sergeybelove.ru
  • 3. Agenda ➔ Download file by a link ➔ Secret keys ➔ Temporary tokens ➔ 3rd party websites on the main domain ➔ 3rd party monitorings and sensitive data ➔ Push notifications vs SMS ➔ FFmpeg / ImageMagick ➔ Serving user content ➔ Crypto
  • 5. Jira task: Allow users to download files by a link Developer: <?php file_get_contents($_POST['url']); ?> Hacker: url = file:///etc/passwd url = http://10.0.0.2 Download file by a link and SSRF
  • 6. What we should to check? 1. Scheme - http/https 2. destination_ip - not in local network / not in trusted zone 3. Check URL after redirections 4. destination_port (allows 80/443) 5. Race Condition - Resolving (IP is external - OK) - Trying to download file - new DNS resolve (!) - In step above attacker can respond with internal IP Solution: do only one resolve and pass this IP to http lib 1. Vulnerabilities of HTTP libraries (such as cURL) 2. IPv6 3. … 4. Create server in external network with API for such tasks 5. 2 network links - 1st for external and file downloading / 2nd for administration 6. You can be inspired by - https://github.com/fin1te/safecurl Download file by a link and SSRF
  • 8. Secret keys ● Keys for signing stateless things (sessions) ● Secret for crypto functions, anti-CSRF / password reset tokens etc ● Credentials for connecting to external API/Databases ● login:password for trackers / analytics ● Initialization vectors ● ... One main rule - do not hardcode them! Move them to config files / deploy via Puppet Hiera-Eyaml
  • 10. Temporary tokens Examples ● Password remind ● Leave feedback ● Confirm action ● ... Threats ● access_log and incorrect ACL (developers can read it?) ● Email forwarding ● Browser history
  • 11. These tokens: ● Should not start “real” session (like after login) ● Their lifetime is minimal and usually depends on business purposes (from minutes to months) ● Bind to the parameters for this action (order id, user, action) Temporary tokens
  • 12. 3rd party websites on the main domain
  • 13. 3rd party websites on the main domain Business want: ● Promo sites ● Sites with vacancies, blogs ● Sites from outsources ● Support / ticket systems ● Custom projects ● etc Could be opened at: http://example.com/projectname
  • 14. What people do? ● Hosting on the same server ● proxy_pass + nginx How to implement it secure? ● Same top header for all pages and <iframe sandbox … > without allow-top-navigation + CSP ● Share user’s data with postMessage 3rd party websites on the main domain
  • 15. 3rd party monitorings and sensitive data
  • 16. Pages: - Password change - Credit card linking - Account recovery - 2 step auth handling - And other important pages Should not (not recommended) contain external trackers / analytics / any other statics (pictures, styles, etc.) from domains that do not belong to the company 3rd party monitorings and sensitive data
  • 18. Interception of SMS: ● Attacks via SS7 (completely remotely) ● Targeted interception of SMS (you need to be physically near) ● Through IVR Spoofing (the success of an attack depends on the operator) in case the code is delivered instead of SMS by a call ● Malware ● Re-issue of SIM cards ● Work of special services Interception of Push Notifications: ● Vulnerabilities of Google / Apple / Microsoft ● Incorrect push subscription mechanism (backend problems - set the ID of your device and the victim user ID) ● It is possible to intercept through the privileged applications (for example, to transfer the push on the smart watches, to the multimedia system of the cars, etc.) Push notification vs SMS
  • 19. How to switch from SMS to push notifications: 1) The first confirmation is via SMS. Here you can get device_id for push notifications 2) In push notifications do not transfer the secret data (the confirmation code) visually, do it in payload. The application itself will pull out and substitute this code for the action. 3) Test security of subscription API Push notification vs SMS
  • 21. You are using FFmpeg? ImageMagick? Consider that any user can read any files on the server / execute any OS commands Attacks on video converters: a year later - https://www.phdays.ru/program/213682/ (Emil Lerner and Pavel Cheryomushkin) FFmpeg / ImageMagick
  • 22. FFmpeg / ImageMagick In case if need it: - Do sandboxing (docker / SELinux / etc) - Deploy it in an isolated network - Create REST API - Disable everything that you don’t need (like demuxers - HLS)
  • 24. Few rules 1) Serve from another domain (* .example-content-from-users.com) 2) Disable interpreters on the backend 3) If the file is private (attachment) - generate a temporary token and is check it when it is opened (for example, through nginx + LUA) Serving user content
  • 26. Crypto Do not implement your own cryptography even if it seems right to you
  • 27. Do not know what to choose? ● Take your case ● Choose a popular framework / CMS (WP / Django / RoR) ● See how it's done there Crypto
  • 29. Your methods should support: 1) The ability to restrict API calls to methods (by user with time shift) 2) Have the ability to monitor how many times a method is invoked (allows you to detect mass attacks) 3) Implement several rate limit methods: absolute (for example, 5 times a minute), after confirmation (after entering the captcha) Rate limits