Upgrade to Pro — share decks privately, control downloads, hide ads and more …

.NET Day 22 - Dependency confusion and its cure. A NuGet story. by Andrei Epure

dotnetday
September 03, 2022

.NET Day 22 - Dependency confusion and its cure. A NuGet story. by Andrei Epure

Supply chain attacks are challenging to discover and can seriously affect the security and reputation of organizations. Alex Birsan described in February 2021 a novel supply chain attack: dependency confusion. Are you sure that the library you are using is from the correct source? Do you know how NuGet works behind the scenes? In this session, Andrei will present what a dependency confusion attack is, the risks it poses, and how .NET developers can guard against it in the NuGet ecosystem.

dotnetday

September 03, 2022
Tweet

More Decks by dotnetday

Other Decks in Technology

Transcript

  1. SolarWinds breach (2020) malware to 18K customers US departments (e.g.

    Defense, State, etc) Microsoft, Intel, Cisco etc FireEye 15
  2. (6) NuGet Package Resolution SOURCE 2 SOURCE 1 Foo 5.3.0

    Foo 5.3.1 build machine network calls 32 My Code Nu Get .exe
  3. SOURCE 2 SOURCE 1 Give me: - Foo 5.3.* Foo

    5.3.0 Foo 5.3.1 33 (6) NuGet Package Resolution My Code Nu Get .exe
  4. Nu Get .exe Foo 5.3.1 Best match from ALL sources

    is: - Foo 5.3.1 Foo 5.3.0 SOURCE 1 SOURCE 2 34 (6) NuGet Package Resolution My Code
  5. SOURCE 1 Foo 5.3.1 Foo 5.3.1 Give me: - Foo

    5.3.* Give me: - Foo 5.3.1 SOURCE 2 35 (6) NuGet Package Resolution My Code Nu Get .exe
  6. Nu Get .exe SOURCE 1 Foo 5.3.1 Foo 5.3.1 SOURCE

    2 36 (6) NuGet Package Resolution My Code
  7. Nu Get .exe Typosquatting My Code Here you are: Gogle.Protobuf

    5.3.2 Gogle.Protobuf 5.3.2 NUGET.ORG 44
  8. PRIVATE SOURCE Substitution attack My Code Corporate.Private.Library 5.3.1 Give me:

    - Foo 5.3.* Give me: Corporate.Private.Library 5.3.1 NUGET.ORG Nu Get .exe 47
  9. PRIVATE SOURCE Substitution attack Corporate.Private.Library 5.3.1 NUGET.ORG My Code Give

    me: Corporate.Private.Library 5.3.1 Corporate.Private.Library 5.3.1 Nu Get .exe 49
  10. PRIVATE SOURCE Substitution attack Give me: - Foo 5.3.* Give

    me: Corporate.Private.Library 5.3.* NUGET.ORG My Code Corporate.Private.Library 5.3.1 Corporate.Private.Library 5.3.2 Nu Get .exe 51
  11. PRIVATE SOURCE Substitution attack NUGET.ORG My Code Corporate.Private.Library 5.3.1 Corporate.Private.Library

    5.3.2 Give me: Corporate.Private.Library 5.3.* Corporate.Private.Library 5.3.999 Nu Get .exe 52
  12. Nu Get .exe PRIVATE SOURCE Substitution attack Here you are:

    Corporate.Private.Library 5.3.999 NUGET.ORG My Code Corporate.Private.Library 5.3.1 Corporate.Private.Library 5.3.2 Corporate.Private.Library 5.3.999 53
  13. We’re hiring! • .NET Developer Advocate • .NET Ecosystem Product

    Manager • C# Developers sonarsource.com/company/careers 75
  14. Credits 79 • Microsoft • Apple • Shopify • Paypal

    • … and another 31 big companies … In 2020, security researcher Alex Bîrsan 󰐬 used substitution attack to hack into:
  15. Credits 80 • Microsoft $ 40K • Apple $ 30K

    • Shopify $ 30K • Paypal $ 30K • … and another 31 big companies … Bug bounties In 2020, security researcher Alex Bîrsan 󰐬 used substitution attack to hack into:
  16. Deterministic Builds This allows mapping of a package to a

    specific commit: increase transparency and allow consumers to audit open-source code. 84
  17. Fixed Versions - it is safer to use fixed versions

    (have full knowledge and control over the supply chain) 85
  18. packages.lock.json - have control over all dependencies (direct and transitive)

    - extra mile: verify checksums (have full knowledge and control over the supply chain) 86