SlideShare ist ein Scribd-Unternehmen logo
1 von 19
Downloaden Sie, um offline zu lesen
Juho Nurminen TurkuSec meetup, March 2017
The sorry state of Finnish
e-payment APIs
...and how to use them securely
1
Juho Nurminen TurkuSec meetup, March 2017
Who am I?
● Hacker, researcher, developer, student
● Professionally breaking web and mobile software at 2NS
○ Also hacking networks, IoT devices, doing code reviews, handling
responsible disclosure, doing generic IT stuff…
● Vulnerability researcher and bug bounty hunter
○ Google, Mozilla, F-Secure, Avast!, LähiTapiola, Piwik, ...
○ Firefox and Chrome: CVE-2011-2800, CVE-2011-3877,
CVE-2014-1527, CVE-2015-1261, CVE-2015-4508
● Also, taking care of rescue cats at Dewi ry
2
Juho Nurminen TurkuSec meetup, March 2017
What's an e-payment API?
● Allows businesses to accept payments online
● A major reason to why online shopping in Finland is so easy
● Provided by banks and Payment Service Providers (PSPs)
○ Nordea, OP, Handelsbanken, S-Pankki, Ålandsbanken…
○ Paytrail, Checkout Finland, Maksuturva…
● Every provider has their own spec and implementation
● Bank e-payment APIs often closely resemble TUPAS
3
Juho Nurminen TurkuSec meetup, March 2017
Side track: TUPAS
● "Tunnistuspalvelu asiointipalveluntarjoajille"
● The de facto standard for strong customer
authentication in Finland
● Maintained by Finanssialan Keskusliitto (FK)
● Implemented by individual banks according to FK standards
● Enables authenticating to online services using bank credentials
● Design has a lot in common with Finnish e-payment APIs
4
Juho Nurminen TurkuSec meetup, March 2017
Side track: TUPAS
Source: fkl.fi
5
Juho Nurminen TurkuSec meetup, March 2017
● Merchant creates a signed
payment request
● Customer receives message,
forwards it to the bank
● Bank does validation, then
initiates 2FA authentication
● Customer authenticates to
bank, approves payment
● Bank creates a signed reply
● Customer forwards the
message back to merchant
6
How bank
e-payments work
Payment
Payment status
Redirection
payment
approval
Juho Nurminen TurkuSec meetup, March 2017
E-payment message format
● Messages are submitted to the bank via HTTP POST as
application/x-www-form-urlencoded
● Field naming and exact format varies, contents are more or less the same
7
POST /epayment-endpoint HTTP/1.1
Host: bankhost.example.com
...
Content-Type: application/x-www-form-urlencoded
field_1=value_1&field_2=value_2&...&field_n=value_
n&hmacfield=0123456789ABCDEF0123456789ABCDEF
Juho Nurminen TurkuSec meetup, March 2017
E-payment message format: Nordea
8
Source: nordea.fi
Juho Nurminen TurkuSec meetup, March 2017
E-payment message format: Nordea
9
Source: nordea.fi
Juho Nurminen TurkuSec meetup, March 2017
Calculating the HMAC
10
● Hash function: MD5 or SHA256
● Field values are concatenated together with secret key, separated by a
single-character delimiter
○ Different delimiters in different implementations: "&", "+", "|", or none
sha256(value_1&value_2&...&value_m&secret_key)
● Not all fields are included in the calculation
○ Those omitted are not protected from modifications
Juho Nurminen TurkuSec meetup, March 2017
The problem with e-payment APIs:
hash functions
● Starting with the obvious: MD5 still in use
○ The only option when using Nordea, OP, Paytrail, or S-Pankki
○ Supported in Checkout Finland, OmaSP, POP Pankki, Säästöpankki, and Ålandsbanken
● Attacks may not always be possible due to restrictions on field lengths
○ BUT: S-Pankki and Ålandsbanken only apply restrictions on some fields
○ Paytrail allows ridiculous field lengths despite specifying an upper limit
● A collision attack could potentially allow forging arbitrary messages
11
Juho Nurminen TurkuSec meetup, March 2017
The problem with e-payment APIs:
self-contradictory documentation
● Documentation is sometimes inaccurate, even wrong
● Often not even possible to use APIs exactly as specified
● E.g.: Most API docs say only alphanumeric chars allowed in field values
○ Yet some fields are supposed contain URLs
○ ...and some fields are supposed to contain decimal points or commas
○ How do you specify a URL without using ":" or "/" ?
○ Since when are decimal points and commas alphanumeric?
12
Juho Nurminen TurkuSec meetup, March 2017
The problem with e-payment APIs:
no escaping in field values
● Special characters, including HMAC
delimiters, never escaped when
calculating the HMAC
● If an end-user controls an HMAC field,
they may be able to break out
● Allows an attacker to modify messages
without changing the HMAC
● Spoofed messages let the attacker pay
less for products and services they buy
13
● A real-world attack, with most likely
plenty of vulnerable services out there
● It's basically free money, so go get it
None of this
Juho Nurminen TurkuSec meetup, March 2017
Breaking out of an
e-payment message field
14
Live demo!
Juho Nurminen TurkuSec meetup, March 2017
The problem with e-payment APIs:
case OP
● The OP e-payment API doesn't use any delimiters in
HMAC calculations
● This, and the structure of the messages, lead to
payment sums being easily manipulated
○ Not dependent on merchant implementations
○ No special conditions required
● A potentially huge issue, could have caused big
losses for companies using the API
15
Source: op.fi
Juho Nurminen TurkuSec meetup, March 2017
The problem with e-payment APIs:
case OP
● Vulnerability reported to tietoturvailmoitukset@op.fi
○ OP: Yes, it's a vulnerability, and yes, it's exploitable. But... did
risk analysis, not worth fixing
● Not satisfied with response, reported to NCSC-FI
○ NCSC-FI: Looks bad, but can't force OP to take action. Will hold a meeting with them.
● A few days pass, I get a quick phone call from OP
● This was in late November / early December, no contact from OP since
16
Source: op.fi
Juho Nurminen TurkuSec meetup, March 2017
The problem with e-payment APIs:
case OP
● Vulnerability reported to tietoturvailmoitukset@op.fi
○ OP: Yes, it's a vulnerability, and yes, it's exploitable. But... did
risk analysis, not worth fixing
● Not satisfied with response, reported to NCSC-FI
○ NCSC-FI: Looks bad, but can't force OP to take action. Will hold a meeting with them.
● A few days pass, I get a quick phone call from OP
● This was in late November / early December, no contact from OP since
17
Source: op.fi
Juho Nurminen TurkuSec meetup, March 2017
Using e-payment APIs securely
● Don't use bank APIs directly, pick a PSP instead!
○ Some PSPs offer XML or JSON based APIs, which seem ok
● Don't allow user input in requests, not even in fields you don't think
matter!
○ If you absolutely have to, restrict it as much as you can
● Validate everything, and be strict about it!
○ Also remember to validate outputs
○ E.g. if the response contains a payment reference, make sure it matches the one you sent
in the request--even if you're not using the payment reference for anything!
18
Juho Nurminen TurkuSec meetup, March 2017
Questions?
19
jupenur@protonmail.ch
twitter.com/jupenur
linkedin.com/in/jupenur

Weitere ähnliche Inhalte

Andere mochten auch

Research Brief: Federal Reserve // March 2017
Research Brief: Federal Reserve // March 2017Research Brief: Federal Reserve // March 2017
Research Brief: Federal Reserve // March 2017Nicole Wesley-Smith
 
Comment automatiser l'exploitation de vos données webanalytics
Comment automatiser l'exploitation de vos données webanalyticsComment automatiser l'exploitation de vos données webanalytics
Comment automatiser l'exploitation de vos données webanalyticsuptilab
 
Why It Takes 7-13+ Touches to Generate a Qualified B2B Sales Lead Today
Why It Takes 7-13+ Touches to Generate a Qualified B2B Sales Lead TodayWhy It Takes 7-13+ Touches to Generate a Qualified B2B Sales Lead Today
Why It Takes 7-13+ Touches to Generate a Qualified B2B Sales Lead TodayVivastream
 
Identifying your Target Audience: How to Define and Maximize It
Identifying your Target Audience: How to Define and Maximize ItIdentifying your Target Audience: How to Define and Maximize It
Identifying your Target Audience: How to Define and Maximize ItMatt Haag
 
Ilb ira brochure-20140327145457
Ilb ira brochure-20140327145457Ilb ira brochure-20140327145457
Ilb ira brochure-20140327145457Michael Kleven
 
Dockercon 2015 - Faster Cheaper Safer
Dockercon 2015 - Faster Cheaper SaferDockercon 2015 - Faster Cheaper Safer
Dockercon 2015 - Faster Cheaper SaferAdrian Cockcroft
 
Using Mind Map for Software Testing Activities
Using Mind Map for Software Testing ActivitiesUsing Mind Map for Software Testing Activities
Using Mind Map for Software Testing ActivitiesAkira Ikeda
 
Looking for your next career move?
Looking for your next career move? Looking for your next career move?
Looking for your next career move? Shannon Le Roux
 
関西NIPS+読み会発表スライド
関西NIPS+読み会発表スライド関西NIPS+読み会発表スライド
関西NIPS+読み会発表スライドYuchi Matsuoka
 
Vertica And Spark: Connecting Computation And Data
Vertica And Spark: Connecting Computation And DataVertica And Spark: Connecting Computation And Data
Vertica And Spark: Connecting Computation And DataSpark Summit
 
How to Spot a Liar
How to Spot a LiarHow to Spot a Liar
How to Spot a LiarDan Rolls
 

Andere mochten auch (15)

Research Brief: Federal Reserve // March 2017
Research Brief: Federal Reserve // March 2017Research Brief: Federal Reserve // March 2017
Research Brief: Federal Reserve // March 2017
 
Comment automatiser l'exploitation de vos données webanalytics
Comment automatiser l'exploitation de vos données webanalyticsComment automatiser l'exploitation de vos données webanalytics
Comment automatiser l'exploitation de vos données webanalytics
 
บทที่8กฎหมายคอมพิวเตอร์[1]
บทที่8กฎหมายคอมพิวเตอร์[1]บทที่8กฎหมายคอมพิวเตอร์[1]
บทที่8กฎหมายคอมพิวเตอร์[1]
 
Why It Takes 7-13+ Touches to Generate a Qualified B2B Sales Lead Today
Why It Takes 7-13+ Touches to Generate a Qualified B2B Sales Lead TodayWhy It Takes 7-13+ Touches to Generate a Qualified B2B Sales Lead Today
Why It Takes 7-13+ Touches to Generate a Qualified B2B Sales Lead Today
 
Origen y evolucion del teatro
Origen y evolucion del teatroOrigen y evolucion del teatro
Origen y evolucion del teatro
 
Identifying your Target Audience: How to Define and Maximize It
Identifying your Target Audience: How to Define and Maximize ItIdentifying your Target Audience: How to Define and Maximize It
Identifying your Target Audience: How to Define and Maximize It
 
Ilb ira brochure-20140327145457
Ilb ira brochure-20140327145457Ilb ira brochure-20140327145457
Ilb ira brochure-20140327145457
 
Dockercon 2015 - Faster Cheaper Safer
Dockercon 2015 - Faster Cheaper SaferDockercon 2015 - Faster Cheaper Safer
Dockercon 2015 - Faster Cheaper Safer
 
Using Mind Map for Software Testing Activities
Using Mind Map for Software Testing ActivitiesUsing Mind Map for Software Testing Activities
Using Mind Map for Software Testing Activities
 
Nativescript with angular 2
Nativescript with angular 2Nativescript with angular 2
Nativescript with angular 2
 
Looking for your next career move?
Looking for your next career move? Looking for your next career move?
Looking for your next career move?
 
関西NIPS+読み会発表スライド
関西NIPS+読み会発表スライド関西NIPS+読み会発表スライド
関西NIPS+読み会発表スライド
 
Vertica And Spark: Connecting Computation And Data
Vertica And Spark: Connecting Computation And DataVertica And Spark: Connecting Computation And Data
Vertica And Spark: Connecting Computation And Data
 
Politica e social media: regole minime di sopravvivenza
Politica e social media: regole minime di sopravvivenzaPolitica e social media: regole minime di sopravvivenza
Politica e social media: regole minime di sopravvivenza
 
How to Spot a Liar
How to Spot a LiarHow to Spot a Liar
How to Spot a Liar
 

Ähnlich wie The sorry state of Finnish e-payment APIs

figo Banking API: A Banking Service Provider for FinTech Startups
figo Banking API: A Banking Service Provider for FinTech Startupsfigo Banking API: A Banking Service Provider for FinTech Startups
figo Banking API: A Banking Service Provider for FinTech StartupsLars Markull
 
Digital platform and mobile app for banks and credit unions
Digital platform and mobile app for banks and credit unionsDigital platform and mobile app for banks and credit unions
Digital platform and mobile app for banks and credit unionsMikhail Miroshnichenko
 
Fintech Belgium Summit 2017 - PSD2 - Anthony Verhelpen
Fintech Belgium Summit 2017 - PSD2 - Anthony VerhelpenFintech Belgium Summit 2017 - PSD2 - Anthony Verhelpen
Fintech Belgium Summit 2017 - PSD2 - Anthony VerhelpenFinTech Belgium
 
Kontomatik FinDEVr Presentation 2015
Kontomatik FinDEVr Presentation 2015Kontomatik FinDEVr Presentation 2015
Kontomatik FinDEVr Presentation 2015Kontomatik
 
figo the Backbone of next generation financial services
figo the Backbone of next generation financial servicesfigo the Backbone of next generation financial services
figo the Backbone of next generation financial servicesfigo GmbH
 
The achilles heel of GPN Card implementation
The achilles heel of GPN Card implementationThe achilles heel of GPN Card implementation
The achilles heel of GPN Card implementationidsecconf
 
Shopping At Mall without standing in Queue for Bill Payment by Scanning Bar c...
Shopping At Mall without standing in Queue for Bill Payment by Scanning Bar c...Shopping At Mall without standing in Queue for Bill Payment by Scanning Bar c...
Shopping At Mall without standing in Queue for Bill Payment by Scanning Bar c...Radhika Talaviya
 
DingoDot Pitch Deck for Investors
DingoDot Pitch Deck for InvestorsDingoDot Pitch Deck for Investors
DingoDot Pitch Deck for InvestorsPeter Fusek
 
Open APIs are changing the next generation of financial services
Open APIs are changing the next generation of financial servicesOpen APIs are changing the next generation of financial services
Open APIs are changing the next generation of financial servicesfigo GmbH
 
Collaboration between financial institutions and startups after introduction ...
Collaboration between financial institutions and startups after introduction ...Collaboration between financial institutions and startups after introduction ...
Collaboration between financial institutions and startups after introduction ...Mariusz Ożga
 
European Open Source Anchors in the Supply Chain
European Open Source Anchors in the Supply ChainEuropean Open Source Anchors in the Supply Chain
European Open Source Anchors in the Supply ChainOW2
 
Trustpay-digital payment platform
Trustpay-digital payment platformTrustpay-digital payment platform
Trustpay-digital payment platformTRUSTpay
 
Trustpay-digital payment platform
Trustpay-digital payment platformTrustpay-digital payment platform
Trustpay-digital payment platformTRUSTpay
 
Upvest - Asset Tokenization - A practical deep dive
Upvest - Asset Tokenization - A practical deep diveUpvest - Asset Tokenization - A practical deep dive
Upvest - Asset Tokenization - A practical deep diveAlexander Reichhardt
 
Insight Collection - The Rise of Fintech, by Fintech OS
Insight Collection - The Rise of Fintech, by Fintech OSInsight Collection - The Rise of Fintech, by Fintech OS
Insight Collection - The Rise of Fintech, by Fintech OSfintechos
 
PSD2 e Instant payments: l’evoluzione attesa dei pagamenti online, in store e...
PSD2 e Instant payments: l’evoluzione attesa dei pagamenti online, in store e...PSD2 e Instant payments: l’evoluzione attesa dei pagamenti online, in store e...
PSD2 e Instant payments: l’evoluzione attesa dei pagamenti online, in store e...Accenture Italia
 
Future relevance for banks in the data economy
Future relevance for banks in the data economyFuture relevance for banks in the data economy
Future relevance for banks in the data economyMounaim Cortet
 
Introduction - Rakuten Payment Platform team
Introduction - Rakuten Payment Platform teamIntroduction - Rakuten Payment Platform team
Introduction - Rakuten Payment Platform teamDaisuke Matsuda
 
Open apis are changing the next Generation of Financial services - Startplatz...
Open apis are changing the next Generation of Financial services - Startplatz...Open apis are changing the next Generation of Financial services - Startplatz...
Open apis are changing the next Generation of Financial services - Startplatz...figo GmbH
 
(FinPort) TrueLayer deck - Connect Ventures 2016
(FinPort) TrueLayer deck - Connect Ventures 2016(FinPort) TrueLayer deck - Connect Ventures 2016
(FinPort) TrueLayer deck - Connect Ventures 2016Pietro Bezza
 

Ähnlich wie The sorry state of Finnish e-payment APIs (20)

figo Banking API: A Banking Service Provider for FinTech Startups
figo Banking API: A Banking Service Provider for FinTech Startupsfigo Banking API: A Banking Service Provider for FinTech Startups
figo Banking API: A Banking Service Provider for FinTech Startups
 
Digital platform and mobile app for banks and credit unions
Digital platform and mobile app for banks and credit unionsDigital platform and mobile app for banks and credit unions
Digital platform and mobile app for banks and credit unions
 
Fintech Belgium Summit 2017 - PSD2 - Anthony Verhelpen
Fintech Belgium Summit 2017 - PSD2 - Anthony VerhelpenFintech Belgium Summit 2017 - PSD2 - Anthony Verhelpen
Fintech Belgium Summit 2017 - PSD2 - Anthony Verhelpen
 
Kontomatik FinDEVr Presentation 2015
Kontomatik FinDEVr Presentation 2015Kontomatik FinDEVr Presentation 2015
Kontomatik FinDEVr Presentation 2015
 
figo the Backbone of next generation financial services
figo the Backbone of next generation financial servicesfigo the Backbone of next generation financial services
figo the Backbone of next generation financial services
 
The achilles heel of GPN Card implementation
The achilles heel of GPN Card implementationThe achilles heel of GPN Card implementation
The achilles heel of GPN Card implementation
 
Shopping At Mall without standing in Queue for Bill Payment by Scanning Bar c...
Shopping At Mall without standing in Queue for Bill Payment by Scanning Bar c...Shopping At Mall without standing in Queue for Bill Payment by Scanning Bar c...
Shopping At Mall without standing in Queue for Bill Payment by Scanning Bar c...
 
DingoDot Pitch Deck for Investors
DingoDot Pitch Deck for InvestorsDingoDot Pitch Deck for Investors
DingoDot Pitch Deck for Investors
 
Open APIs are changing the next generation of financial services
Open APIs are changing the next generation of financial servicesOpen APIs are changing the next generation of financial services
Open APIs are changing the next generation of financial services
 
Collaboration between financial institutions and startups after introduction ...
Collaboration between financial institutions and startups after introduction ...Collaboration between financial institutions and startups after introduction ...
Collaboration between financial institutions and startups after introduction ...
 
European Open Source Anchors in the Supply Chain
European Open Source Anchors in the Supply ChainEuropean Open Source Anchors in the Supply Chain
European Open Source Anchors in the Supply Chain
 
Trustpay-digital payment platform
Trustpay-digital payment platformTrustpay-digital payment platform
Trustpay-digital payment platform
 
Trustpay-digital payment platform
Trustpay-digital payment platformTrustpay-digital payment platform
Trustpay-digital payment platform
 
Upvest - Asset Tokenization - A practical deep dive
Upvest - Asset Tokenization - A practical deep diveUpvest - Asset Tokenization - A practical deep dive
Upvest - Asset Tokenization - A practical deep dive
 
Insight Collection - The Rise of Fintech, by Fintech OS
Insight Collection - The Rise of Fintech, by Fintech OSInsight Collection - The Rise of Fintech, by Fintech OS
Insight Collection - The Rise of Fintech, by Fintech OS
 
PSD2 e Instant payments: l’evoluzione attesa dei pagamenti online, in store e...
PSD2 e Instant payments: l’evoluzione attesa dei pagamenti online, in store e...PSD2 e Instant payments: l’evoluzione attesa dei pagamenti online, in store e...
PSD2 e Instant payments: l’evoluzione attesa dei pagamenti online, in store e...
 
Future relevance for banks in the data economy
Future relevance for banks in the data economyFuture relevance for banks in the data economy
Future relevance for banks in the data economy
 
Introduction - Rakuten Payment Platform team
Introduction - Rakuten Payment Platform teamIntroduction - Rakuten Payment Platform team
Introduction - Rakuten Payment Platform team
 
Open apis are changing the next Generation of Financial services - Startplatz...
Open apis are changing the next Generation of Financial services - Startplatz...Open apis are changing the next Generation of Financial services - Startplatz...
Open apis are changing the next Generation of Financial services - Startplatz...
 
(FinPort) TrueLayer deck - Connect Ventures 2016
(FinPort) TrueLayer deck - Connect Ventures 2016(FinPort) TrueLayer deck - Connect Ventures 2016
(FinPort) TrueLayer deck - Connect Ventures 2016
 

Kürzlich hochgeladen

GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
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
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
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
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
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
 
🐬 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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 

Kürzlich hochgeladen (20)

GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
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
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
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
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
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
 
🐬 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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 

The sorry state of Finnish e-payment APIs

  • 1. Juho Nurminen TurkuSec meetup, March 2017 The sorry state of Finnish e-payment APIs ...and how to use them securely 1
  • 2. Juho Nurminen TurkuSec meetup, March 2017 Who am I? ● Hacker, researcher, developer, student ● Professionally breaking web and mobile software at 2NS ○ Also hacking networks, IoT devices, doing code reviews, handling responsible disclosure, doing generic IT stuff… ● Vulnerability researcher and bug bounty hunter ○ Google, Mozilla, F-Secure, Avast!, LähiTapiola, Piwik, ... ○ Firefox and Chrome: CVE-2011-2800, CVE-2011-3877, CVE-2014-1527, CVE-2015-1261, CVE-2015-4508 ● Also, taking care of rescue cats at Dewi ry 2
  • 3. Juho Nurminen TurkuSec meetup, March 2017 What's an e-payment API? ● Allows businesses to accept payments online ● A major reason to why online shopping in Finland is so easy ● Provided by banks and Payment Service Providers (PSPs) ○ Nordea, OP, Handelsbanken, S-Pankki, Ålandsbanken… ○ Paytrail, Checkout Finland, Maksuturva… ● Every provider has their own spec and implementation ● Bank e-payment APIs often closely resemble TUPAS 3
  • 4. Juho Nurminen TurkuSec meetup, March 2017 Side track: TUPAS ● "Tunnistuspalvelu asiointipalveluntarjoajille" ● The de facto standard for strong customer authentication in Finland ● Maintained by Finanssialan Keskusliitto (FK) ● Implemented by individual banks according to FK standards ● Enables authenticating to online services using bank credentials ● Design has a lot in common with Finnish e-payment APIs 4
  • 5. Juho Nurminen TurkuSec meetup, March 2017 Side track: TUPAS Source: fkl.fi 5
  • 6. Juho Nurminen TurkuSec meetup, March 2017 ● Merchant creates a signed payment request ● Customer receives message, forwards it to the bank ● Bank does validation, then initiates 2FA authentication ● Customer authenticates to bank, approves payment ● Bank creates a signed reply ● Customer forwards the message back to merchant 6 How bank e-payments work Payment Payment status Redirection payment approval
  • 7. Juho Nurminen TurkuSec meetup, March 2017 E-payment message format ● Messages are submitted to the bank via HTTP POST as application/x-www-form-urlencoded ● Field naming and exact format varies, contents are more or less the same 7 POST /epayment-endpoint HTTP/1.1 Host: bankhost.example.com ... Content-Type: application/x-www-form-urlencoded field_1=value_1&field_2=value_2&...&field_n=value_ n&hmacfield=0123456789ABCDEF0123456789ABCDEF
  • 8. Juho Nurminen TurkuSec meetup, March 2017 E-payment message format: Nordea 8 Source: nordea.fi
  • 9. Juho Nurminen TurkuSec meetup, March 2017 E-payment message format: Nordea 9 Source: nordea.fi
  • 10. Juho Nurminen TurkuSec meetup, March 2017 Calculating the HMAC 10 ● Hash function: MD5 or SHA256 ● Field values are concatenated together with secret key, separated by a single-character delimiter ○ Different delimiters in different implementations: "&", "+", "|", or none sha256(value_1&value_2&...&value_m&secret_key) ● Not all fields are included in the calculation ○ Those omitted are not protected from modifications
  • 11. Juho Nurminen TurkuSec meetup, March 2017 The problem with e-payment APIs: hash functions ● Starting with the obvious: MD5 still in use ○ The only option when using Nordea, OP, Paytrail, or S-Pankki ○ Supported in Checkout Finland, OmaSP, POP Pankki, Säästöpankki, and Ålandsbanken ● Attacks may not always be possible due to restrictions on field lengths ○ BUT: S-Pankki and Ålandsbanken only apply restrictions on some fields ○ Paytrail allows ridiculous field lengths despite specifying an upper limit ● A collision attack could potentially allow forging arbitrary messages 11
  • 12. Juho Nurminen TurkuSec meetup, March 2017 The problem with e-payment APIs: self-contradictory documentation ● Documentation is sometimes inaccurate, even wrong ● Often not even possible to use APIs exactly as specified ● E.g.: Most API docs say only alphanumeric chars allowed in field values ○ Yet some fields are supposed contain URLs ○ ...and some fields are supposed to contain decimal points or commas ○ How do you specify a URL without using ":" or "/" ? ○ Since when are decimal points and commas alphanumeric? 12
  • 13. Juho Nurminen TurkuSec meetup, March 2017 The problem with e-payment APIs: no escaping in field values ● Special characters, including HMAC delimiters, never escaped when calculating the HMAC ● If an end-user controls an HMAC field, they may be able to break out ● Allows an attacker to modify messages without changing the HMAC ● Spoofed messages let the attacker pay less for products and services they buy 13 ● A real-world attack, with most likely plenty of vulnerable services out there ● It's basically free money, so go get it None of this
  • 14. Juho Nurminen TurkuSec meetup, March 2017 Breaking out of an e-payment message field 14 Live demo!
  • 15. Juho Nurminen TurkuSec meetup, March 2017 The problem with e-payment APIs: case OP ● The OP e-payment API doesn't use any delimiters in HMAC calculations ● This, and the structure of the messages, lead to payment sums being easily manipulated ○ Not dependent on merchant implementations ○ No special conditions required ● A potentially huge issue, could have caused big losses for companies using the API 15 Source: op.fi
  • 16. Juho Nurminen TurkuSec meetup, March 2017 The problem with e-payment APIs: case OP ● Vulnerability reported to tietoturvailmoitukset@op.fi ○ OP: Yes, it's a vulnerability, and yes, it's exploitable. But... did risk analysis, not worth fixing ● Not satisfied with response, reported to NCSC-FI ○ NCSC-FI: Looks bad, but can't force OP to take action. Will hold a meeting with them. ● A few days pass, I get a quick phone call from OP ● This was in late November / early December, no contact from OP since 16 Source: op.fi
  • 17. Juho Nurminen TurkuSec meetup, March 2017 The problem with e-payment APIs: case OP ● Vulnerability reported to tietoturvailmoitukset@op.fi ○ OP: Yes, it's a vulnerability, and yes, it's exploitable. But... did risk analysis, not worth fixing ● Not satisfied with response, reported to NCSC-FI ○ NCSC-FI: Looks bad, but can't force OP to take action. Will hold a meeting with them. ● A few days pass, I get a quick phone call from OP ● This was in late November / early December, no contact from OP since 17 Source: op.fi
  • 18. Juho Nurminen TurkuSec meetup, March 2017 Using e-payment APIs securely ● Don't use bank APIs directly, pick a PSP instead! ○ Some PSPs offer XML or JSON based APIs, which seem ok ● Don't allow user input in requests, not even in fields you don't think matter! ○ If you absolutely have to, restrict it as much as you can ● Validate everything, and be strict about it! ○ Also remember to validate outputs ○ E.g. if the response contains a payment reference, make sure it matches the one you sent in the request--even if you're not using the payment reference for anything! 18
  • 19. Juho Nurminen TurkuSec meetup, March 2017 Questions? 19 jupenur@protonmail.ch twitter.com/jupenur linkedin.com/in/jupenur