Breaking the Chain: An Attacker's Perspective on Supply Chain Vulnerabilities and Flaws
Ringkasan
TLDRIn this presentation, security researchers Akil Kotokoda and Eli Goldman from Aqua Security explore various vulnerabilities in the software supply chain, particularly focusing on open-source projects and development tools. They discuss the risks associated with different phases of the development flow, including the IDE, SCM, registry, CI/CD, artifacts, and runtime phases. The researchers provide real-world examples of vulnerabilities such as malicious VS Code extensions, repo jacking, package planting, and timing attacks on npm. They emphasize the importance of understanding potential attack vectors and suggest mitigations and best practices for developers and organizations to enhance security against supply chain attacks.
Takeaways
- π Understanding supply chain attacks is crucial for developers.
- π‘οΈ Malicious VS Code extensions can pose significant risks.
- β οΈ Repo jacking can redirect users to malicious repositories.
- π¦ Package planting allows attackers to take control of npm packages.
- β±οΈ Timing attacks can expose private package names on npm.
- π Regularly rotate secrets to minimize exposure.
- π οΈ Use security tools to evaluate open-source projects.
- π Threat modeling helps identify vulnerabilities in development flow.
- π Verified signs in marketplaces can be misleading.
- π£ Report vulnerabilities to improve overall security.
Garis waktu
- 00:00:00 - 00:05:00
Akil Kotokoda and Eli Goldman, security researchers from Aqua Security, introduce their focus on vulnerabilities in the supply chain and open source projects. They highlight the importance of understanding supply chain attacks and the various phases of the development flow, from code writing to production deployment.
- 00:05:00 - 00:10:00
The presentation discusses the risks associated with Visual Studio Code (VS Code) extensions, emphasizing the ease of impersonating popular extensions. They demonstrate how malicious extensions can be disguised and the challenges in distinguishing between legitimate and fake ones, raising concerns about the security of the marketplace.
- 00:10:00 - 00:15:00
The researchers explain the concept of 'repo jacking,' where an attacker can take over a repository after an organization changes its name. They provide examples of how this can lead to users inadvertently accessing malicious repositories, emphasizing the need for organizations to maintain control over their old repository names to prevent exploitation.
- 00:15:00 - 00:20:00
In the registry phase, they discuss a vulnerability in npm that allowed attackers to add themselves as owners of malicious packages. This could mislead developers into installing harmful packages, highlighting the importance of verifying package ownership and the need for better security practices in open source projects.
- 00:20:00 - 00:25:00
The CI/CD phase reveals vulnerabilities in Travis CI that exposed sensitive tokens from numerous open source projects. The researchers found that attackers could access public logs and retrieve sensitive information, stressing the importance of deleting old logs and rotating tokens regularly to mitigate risks.
- 00:25:00 - 00:34:49
Finally, they address the artifact phase, focusing on a timing attack that could disclose private package names on npm. They call for unified security standards across different registries to enhance overall supply chain security, concluding with a reminder of the potential catastrophic consequences of these vulnerabilities and the need for vigilance in the development process.
Peta Pikiran
Video Tanya Jawab
What is the main focus of the research presented?
The research focuses on vulnerabilities in the software supply chain, particularly in open-source projects and development tools.
What are some examples of vulnerabilities discussed?
Examples include malicious VS Code extensions, repo jacking, package planting, and timing attacks on npm.
What is repo jacking?
Repo jacking occurs when an attacker takes control of an old repository name after an organization changes its name, leading users to access the attacker's repository instead.
How can developers protect themselves from malicious packages?
Developers should verify the ownership of packages, use security ranking tools, and regularly audit their dependencies.
What is the significance of the verified sign in marketplaces?
The verified sign indicates that the platform has validated the publisher's identity, but it can be misused if not properly managed.
What recommendations do the speakers provide for organizations?
Organizations should conduct threat modeling, rotate secrets regularly, and ensure security practices are in place at each stage of the development flow.
What is the impact of malicious VS Code extensions?
Malicious extensions can execute harmful actions on a developer's machine, such as stealing credentials or executing ransomware.
What is package planting?
Package planting is a vulnerability where an attacker can add themselves as a new owner of a malicious package on npm.
What should developers do if they find vulnerabilities in their dependencies?
They should report the vulnerabilities to the respective platforms and consider using secret scanning tools.
Why is it important to understand the development flow?
Understanding the development flow helps identify potential exposure points to supply chain attacks and implement appropriate defenses.
Lihat lebih banyak ringkasan video
1 Tablespoon A Day Melts Fat In 7 Days
why i stopped making videos
Hereβs my credit card numbers,including billing address and cvv
hair extensions prep, toning, maintenance & re-taping | 2024
Used To and Would
#1 Concepts Of Strategic Cost Management in different stages of Value Chain | CMA Final | Paper 16
- 00:00:02hello everyone my name is Akil kotokoda
- 00:00:05and I am Eli Goldman and we are security
- 00:00:07researchers from Aqua security and in
- 00:00:10this session we will demonstrate you
- 00:00:11several of accountabilities and flow
- 00:00:12that we found in some platforms so some
- 00:00:15details about us Eli and I have previous
- 00:00:18experience in penetration testing and
- 00:00:19red teaming and we have tried to use
- 00:00:21this experience in our research mindset
- 00:00:23currently we are mainly focused on
- 00:00:25vulnerabilities on the supply chain
- 00:00:27space and in open source projects
- 00:00:30so we first want to start with Iron Man
- 00:00:33sets for This research here in front of
- 00:00:35you are four famous articles about
- 00:00:36supply chain attacks each one of them
- 00:00:39head or could have had destructive
- 00:00:41effects now each attack has its own
- 00:00:44story behind it some begun maybe because
- 00:00:46of a secret exposed in a Docker image
- 00:00:49file ever because a developer was hacked
- 00:00:51the possibilities are endless
- 00:00:53we see all the time today publications
- 00:00:55of a malicious python package was
- 00:00:58uploaded uploaded to pewpie and this is
- 00:01:00a good thing it's a good step to another
- 00:01:02Community but for us to be aware we
- 00:01:04don't just need to seek out malicious
- 00:01:06packages uploaded to the platform where
- 00:01:08we consumer dependencies form we first
- 00:01:10need to understand what makes an attack
- 00:01:12a supply chain attack understand our
- 00:01:14organization's point of exposure to
- 00:01:15supply chain attacks and defend at each
- 00:01:18point because attackers today have many
- 00:01:20entry points to the organization from
- 00:01:22the from the moment the developer writes
- 00:01:25the code on his own laptop until the
- 00:01:26binary is one in production that is why
- 00:01:29we want to raise awareness of attacks in
- 00:01:31each phase of the development flow so
- 00:01:33first a quick recap of the development
- 00:01:36flow we first start with the ID where
- 00:01:38the developer writes his code then we
- 00:01:41move on to the sem phase where the
- 00:01:42developer and his organization store
- 00:01:44their code
- 00:01:45after that we're in the registry phase
- 00:01:47which includes attacks on the platform
- 00:01:49where we consume our dependencies from
- 00:01:51then we will arrive to the cicd phase
- 00:01:53this phase takes everything up to here
- 00:01:56combines the code into one artifact and
- 00:01:58sometimes even deploy it
- 00:02:00after that we are in the artifacts phase
- 00:02:02the artifacts phase is just like the
- 00:02:04register phase reporting on your point
- 00:02:06of view are you a consumer of a package
- 00:02:08or a provider of a package for example
- 00:02:11and finally the runtime phase where our
- 00:02:13code is being executed we speak here
- 00:02:16about original research that we've
- 00:02:17connected in each one of these phases
- 00:02:19except the runtime phase starting with
- 00:02:22the IDE phase he will talk about
- 00:02:24research about Visual Studio code
- 00:02:26extensions
- 00:02:27so first why this code there are many
- 00:02:30code editors as you can see here Sublime
- 00:02:32IntelliJ and this code but this code is
- 00:02:35the most popular one how popular
- 00:02:37according to a survey conducted by stack
- 00:02:39Overflow more than 74 percent of the
- 00:02:41users use vs code as their main IDE
- 00:02:44now viscode is strong tool but its main
- 00:02:46power comes from its extensions there
- 00:02:49are many extensions varying from
- 00:02:50prettifying the code that you write and
- 00:02:52ending with Git integration and debug
- 00:02:54tools how do you install these
- 00:02:56extensions from the marketplace just go
- 00:02:58online search the extension you want to
- 00:03:00install and install it you can do it
- 00:03:02from the web interface as you can see
- 00:03:04here or from the viscode application
- 00:03:06itself
- 00:03:07now that we know how popular are this
- 00:03:10code and the extensions I want to shift
- 00:03:12our view a bit when I tell you npm
- 00:03:15packages what are the associations that
- 00:03:16you are getting
- 00:03:17so of course this is a security
- 00:03:19conference and probably most of us are
- 00:03:21thinking about malicious npm packages
- 00:03:23and indeed when you search Google for
- 00:03:25malicious npm packages you see many
- 00:03:28results of packages stealing credit
- 00:03:29cards and tokens and this is a good
- 00:03:31thing the Publications not the malicious
- 00:03:33packages but what happens when you
- 00:03:35search for mesha's vs code extensions
- 00:03:38there are hardly any results there are
- 00:03:41results about results about vulnerable
- 00:03:43extensions but it's important to state
- 00:03:45that vulnerable is not malicious and
- 00:03:48there are two different things
- 00:03:49okay there aren't any Publications about
- 00:03:52malicious extensions but what can an
- 00:03:55extension even do so the answer it can
- 00:03:58do anything the user can do it runs on
- 00:04:00the progress laptop can run ransomware
- 00:04:02for example or even use the SSH key of
- 00:04:04the programmer to connect to the private
- 00:04:06repositories of visualization in GitHub
- 00:04:09so now that we know the dangers of
- 00:04:11installing a malicious physical
- 00:04:12extensions we want to see how easy it is
- 00:04:15to impersonate a popular extension in
- 00:04:17the marketplace fooling developers into
- 00:04:19installing it so that we chose spirit is
- 00:04:23the fiscal extension that is in the top
- 00:04:2410 installs in the marketplace we
- 00:04:27uploaded our own pretty with warranty I
- 00:04:29want to see the differences and
- 00:04:31similarities let's take a closer look
- 00:04:33we can see marked at 1 the URL there is
- 00:04:37a slight change but not many look at the
- 00:04:39URL what I really want to focus here on
- 00:04:42Watermark two and three in the image you
- 00:04:44can see that they are identical this is
- 00:04:46because this is the Publishers and the
- 00:04:49extensions display name property it does
- 00:04:52not have to be unique and you can put in
- 00:04:53there whatever you want and for example
- 00:04:55here we wrote prettier with two T's
- 00:04:58there's also the installs and reviews
- 00:05:01which is a good measure to understand if
- 00:05:03the extension is okay or not but it can
- 00:05:05be fabricated overall when we look at
- 00:05:08both these extensions it's very hard to
- 00:05:10distinguish which one is the original
- 00:05:12one and which one is the person
- 00:05:13impersonating one but do not worry
- 00:05:15Microsoft is here to help us
- 00:05:18they uploaded a guideline that says can
- 00:05:21I trust extensions from the marketplace
- 00:05:22okay that sounds good and in there they
- 00:05:25tell you here are a few steps that you
- 00:05:27can take in order to make an informed
- 00:05:29decision and one of these steps is
- 00:05:31take a look at the repository that is
- 00:05:33linked to the extension but we were able
- 00:05:36to fabricate the repository in the
- 00:05:38extension to be the same so this does
- 00:05:41not help us at all
- 00:05:42in Microsoft defense other platforms has
- 00:05:44destroyable as well
- 00:05:46now up to here we saw how we can make
- 00:05:50the land page of the extension seems
- 00:05:52similar but how will someone even get to
- 00:05:54our extension when you search for
- 00:05:56pritier in the marketplace there are
- 00:05:58many many results and your extension is
- 00:06:00not even here
- 00:06:01but what happens when someone by mistake
- 00:06:04searches for Britain with one t
- 00:06:07the answer is that our extension is the
- 00:06:09only result and you can even see there
- 00:06:11that in the Box it it results with the
- 00:06:13display name property tweeted with 2T
- 00:06:15making it very hard to distinguish
- 00:06:17we took everything into account here
- 00:06:20how easy it is to impersonate a purple
- 00:06:22extension in the marketplace and what a
- 00:06:25malicious extension can do in your
- 00:06:26computer computer which is anything and
- 00:06:28decided to upload the POC we upload the
- 00:06:30pre-tier with one t so earlier it just
- 00:06:33gave us a little ping when it was
- 00:06:34installed by a developer and the results
- 00:06:37are in front of you Another 48 Hours
- 00:06:40more than 1 000 developers around the
- 00:06:43world installed our own personal
- 00:06:45extension each developer here could have
- 00:06:48been the entry point Focus supply chain
- 00:06:50attack on his internal organization now
- 00:06:52just imagine the scenario of a real
- 00:06:54attacker uploading a real malicious
- 00:06:56extension
- 00:06:58another flow I want to talk to you about
- 00:07:00in the marketplace is the verified sign
- 00:07:02when we see this verified sign the
- 00:07:05associations that we are getting is that
- 00:07:07the platform is validated that the
- 00:07:08person behind this page is indeed with
- 00:07:11lenses let's see an example of the
- 00:07:13social accounts of LeBron James we can
- 00:07:15see we have Instagram Facebook and
- 00:07:17Twitter all of them he has a verified
- 00:07:19sign all of them validated that LeBron
- 00:07:21James is Behind These Pages now let's
- 00:07:24look at the verified sign in the
- 00:07:26marketplace here we can see we have
- 00:07:28semic load here that has an extension of
- 00:07:31two installs okay and a verified sign
- 00:07:33when we put our Mouse on the verified
- 00:07:35sign we can see there is a little pop-up
- 00:07:37that says Santa Claus has a verified
- 00:07:40ownership for the domain semi-cloud.net
- 00:07:43wait what
- 00:07:45let's look at the requirements to even
- 00:07:47get a verified sign in the marketplace
- 00:07:49you go online choose the publisher you
- 00:07:51want to verify enter an eligible domain
- 00:07:54which is just any domain prove that you
- 00:07:58own this domain and that's it this means
- 00:08:01that any developer like semi-cloud here
- 00:08:03can receive a verified sign Sam if
- 00:08:06you're present or listening to this
- 00:08:07recording nothing personal thank you for
- 00:08:10your contribution to our research
- 00:08:12now the sharp eyes of you can see that
- 00:08:14they're verified sign location is near
- 00:08:17the display name property what we did
- 00:08:19pretty with two things before just
- 00:08:21imagine the scenario of an attacker
- 00:08:23receiving a verified sign and then
- 00:08:25changing the display in property to
- 00:08:27pretend with duties
- 00:08:29probably the most suspecting developers
- 00:08:31will be full volume so now what I've
- 00:08:34showed you here are the requirements for
- 00:08:36verified sign before the publication of
- 00:08:38our research
- 00:08:39after the publication Microsoft added a
- 00:08:42little note that says if you change your
- 00:08:45if you change your display name property
- 00:08:46your verified badge will be revoked so
- 00:08:48this is a good mitigation from the
- 00:08:50platform to minimize some of the risks
- 00:08:53another good thing we saw the result of
- 00:08:55the research is that the real prettier
- 00:08:56receive the verified sign they did not
- 00:08:58have before
- 00:08:59the problem remains of what this
- 00:09:01verified sign represents but it's a good
- 00:09:04step from the publisher side
- 00:09:06now we talked a lot about the
- 00:09:08marketplace I want to dig a little
- 00:09:10deeper into what is an extension so an
- 00:09:13extension ends with Visa X which is just
- 00:09:15a zip file and when you unzip this file
- 00:09:18you see there are many other files and
- 00:09:20in one of them a little magic file this
- 00:09:22file is Packet Json so where do you
- 00:09:25remember package.json
- 00:09:27from npm packages what you need to
- 00:09:29understand from now on is that a viscode
- 00:09:32extension is just like an npm package
- 00:09:35and those are the all the dangers of npm
- 00:09:37packages like attacks on dependencies of
- 00:09:39dependencies but this is for another
- 00:09:40session
- 00:09:42now we talked here before that there are
- 00:09:44a lot of publications of malicious npm
- 00:09:46packages I want to introduce you to
- 00:09:48bextable backstable is a collection of
- 00:09:51malicious open source packages hence
- 00:09:54including malicious npm packages that
- 00:09:56was collected over the years
- 00:09:58it is how it looks like it has many
- 00:10:01details about different malicious
- 00:10:02packages including the objective of the
- 00:10:05package like stealing tokens environment
- 00:10:06variables and the method of attack like
- 00:10:09typos quoting
- 00:10:10here's an example of such a package
- 00:10:13you can see the code takes the
- 00:10:14environment variable of the process and
- 00:10:17sends it to the attacker machine
- 00:10:18stealing the environment variables of
- 00:10:20the attacked user now we took a look at
- 00:10:23many packages like this one in order to
- 00:10:26search for patterns of malicious npm
- 00:10:29packages in order to find malicious vs
- 00:10:32code extensions in the marketplace
- 00:10:35for that we used same group same rep is
- 00:10:38a SAS tool that uses rules in order to
- 00:10:40search for patterns inside code
- 00:10:43here's a very simple rule that we wrote
- 00:10:45that just searches for execution
- 00:10:47commands like exec and eval that happen
- 00:10:49after an HTTP event like a get request
- 00:10:51we run it across the marketplace and
- 00:10:54here's the result that we found
- 00:10:55you can see that upon installation of
- 00:10:57the extension the uh the computer will
- 00:11:00go to the attacker's machine make a get
- 00:11:02request
- 00:11:03from the get request take the response
- 00:11:05data and send it to eval which is a
- 00:11:07command execution this means that when a
- 00:11:10developer will install this malicious
- 00:11:12malicious extension upon installation
- 00:11:14the computer will go to the advanced
- 00:11:16domain fetch code and run it locally now
- 00:11:19this can be a malicious extension or
- 00:11:22just a very bad code written by
- 00:11:24developer I can tell you on top of that
- 00:11:26that the domain that you see here was
- 00:11:29available for everyone to buy when we
- 00:11:31encounter this extension this means that
- 00:11:33even if this is not a malicious
- 00:11:35extension an attacker could have bought
- 00:11:37this domain and attack legitimate users
- 00:11:40making it a malicious extension
- 00:11:43either way we report it to Microsoft and
- 00:11:45they removed it from the marketplace of
- 00:11:46course
- 00:11:48another thing we need to understand
- 00:11:49about extensions in the marketplace is
- 00:11:52that when we upload an extension it's
- 00:11:54visible for everyone and we may by
- 00:11:56mistake leak secrets we scanned with
- 00:12:00various scanning tools the marketplace
- 00:12:01and it is an example that we found you
- 00:12:04can see that when you open the Visa X of
- 00:12:06the extension there are many files and
- 00:12:08here there is a little token file and
- 00:12:10what this token file holds
- 00:12:12tokens tokens to the marketplace itself
- 00:12:15this means that when an attacker will
- 00:12:17get this token he can publish a
- 00:12:19malicious extension under the name of an
- 00:12:21innocent publisher we found many other
- 00:12:23tokens like AWS keys and many more of
- 00:12:26course everything is here was revoked
- 00:12:28and reported to the publishers
- 00:12:31so a few mitigations recommendations for
- 00:12:34the IDE phase of the vs code extensions
- 00:12:36first thing first the platforms and
- 00:12:39Publishers responsibility the platform
- 00:12:41has a responsibility for us the
- 00:12:43consumers especially a platform where
- 00:12:45Anonymous users can upload an extension
- 00:12:47to minimize our points of exposure we
- 00:12:50saw they mitigated some of the risks in
- 00:12:52the verified sign but there are many
- 00:12:54other flaws that need to be taken care
- 00:12:56of
- 00:12:57the Publishers also have responsibility
- 00:12:59there is a verified mechanism apply for
- 00:13:01IT Help users identify you
- 00:13:06there is a brand new world out there or
- 00:13:09vulnerability is secrets and maybe even
- 00:13:11malicious activities in the marketplace
- 00:13:13are you an extension developer be sure
- 00:13:16to scan your extensions for
- 00:13:17vulnerabilities and secrets before you
- 00:13:19upload them to the marketplace you may
- 00:13:21never know which token you may have
- 00:13:22leaked by mistake starting a supply
- 00:13:24chain attack on your organization
- 00:13:26most importantly we've shown here how we
- 00:13:29can attack developers even before they
- 00:13:31write their code we call it shift left
- 00:13:33lift attacking the developers now these
- 00:13:36results were shown on this code in the
- 00:13:38marketplace but there are many more
- 00:13:40ideas and their own Marketplace that
- 00:13:43probably have the same flaws
- 00:13:46okay
- 00:13:47we finished with ID phase about this
- 00:13:49code and moving on to the SCM phase he
- 00:13:52will talk about an attack called
- 00:13:54reprojecting so first what is
- 00:13:56reprojecting let's start with an example
- 00:13:59assume an organization called
- 00:14:00marginization and within the repository
- 00:14:03called my lipo in order for user to
- 00:14:05access this repository you'll need to
- 00:14:07browse the URL in front of you
- 00:14:09now the organization decides to change
- 00:14:11their name to new organization so the
- 00:14:13users will need to access the new URL
- 00:14:15instead
- 00:14:16however what will happen if a user
- 00:14:19accesses the old URL by mistake
- 00:14:22there will be an HTTP redirect and
- 00:14:24everything will be okay
- 00:14:25but now because the organization changed
- 00:14:28their name then my organization name is
- 00:14:30free for everyone to take what will
- 00:14:32happen if an attacker creates the
- 00:14:34marginalization organization and reflect
- 00:14:37the my repo Repository
- 00:14:39there will no longer be a redirect and
- 00:14:41users that access the old URL of the
- 00:14:43legitimate repository by mistake will
- 00:14:46actually access the attacker's
- 00:14:47Repository
- 00:14:48this is the call of repo jacking there
- 00:14:50are more scenarios like transferring the
- 00:14:52ownership instead of rename but it's all
- 00:14:54about the same
- 00:14:55now there are some restrictions deployed
- 00:14:58by GitHub of the capability of the
- 00:15:00attacker of opening dual repository name
- 00:15:02but just in 2022 there were so many
- 00:15:06bypasses to these restrictions defined
- 00:15:08by GitHub so as a result in our research
- 00:15:11in our research and this presentation a
- 00:15:14repository that has a redirect for its
- 00:15:16old name and the old name is available
- 00:15:18to take counted as vulnerable
- 00:15:20nevertheless
- 00:15:22all the examples we're going to show
- 00:15:24here were fully exploitable even with
- 00:15:27the the protections deployed by GitHub
- 00:15:30so up to here one is so the triple
- 00:15:32checking is just a redirect not
- 00:15:34happening right let's understand a few
- 00:15:37exploitation scenarios for this attack
- 00:15:39a link in the code to the previous name
- 00:15:41this can be when in the code itself
- 00:15:43there is a reference to your level
- 00:15:45repository to download the resource for
- 00:15:47example we're going to go module file a
- 00:15:49go module Imports uh installation guide
- 00:15:52references
- 00:15:53this can be when in written instructions
- 00:15:55there is a reference to the URL of the
- 00:15:58repository but when the organization
- 00:15:59changed their name they forgot to change
- 00:16:01the written instructions we'll see an
- 00:16:03example of this
- 00:16:04and how to cover Link in post across the
- 00:16:06internet
- 00:16:07and scenario of this someone recommends
- 00:16:09a specific tool in stack Overflow
- 00:16:10linking a repository after the answer
- 00:16:12the only of the repository change the
- 00:16:15organization name but of course the
- 00:16:17stack Overflow enter remained the same
- 00:16:19let's see some real life examples here
- 00:16:22we have a Google project Google Map
- 00:16:24steps that was probably transferred to
- 00:16:26their ownership but they forgot to
- 00:16:28change the readme instructions let's
- 00:16:29take a closer look at the readme
- 00:16:32here we can see Google is the access to
- 00:16:33do a git clone to the socratic map steps
- 00:16:36and not the Google Map steps and indeed
- 00:16:38when you access this URL you get
- 00:16:40redirected to Google Map steps however
- 00:16:43when an attacker will create a Socratic
- 00:16:46organization and within the math steps
- 00:16:48repository they will no longer be a
- 00:16:50redirect and users that follow Google's
- 00:16:52instructions will actually clone the
- 00:16:54attackers Repository
- 00:16:56when Google is accessed to do npm
- 00:16:58install which will result in remote code
- 00:17:00execution of the attacker on Google
- 00:17:02users we made a POC on this repository
- 00:17:05we opened a socatic organization and
- 00:17:08within it the Master's repository and
- 00:17:10the uploaded repository to give us a
- 00:17:12little ping when npm install was
- 00:17:13executed we got number as a result of
- 00:17:16code execution on open source users and
- 00:17:18developers of big companies
- 00:17:22another example I want to show you here
- 00:17:23is this installer sales script we can
- 00:17:26see inside the script there is the
- 00:17:27download URI which points to a zip
- 00:17:29inside the repository that is vulnerable
- 00:17:32to repo jacking now it it the script
- 00:17:35downloads this ZIP locally and unzips it
- 00:17:38and from the zip takes the Dominos stage
- 00:17:41script and executes it
- 00:17:43this means that when an attacker will
- 00:17:45create a yes graph organization that is
- 00:17:47in the download URI the s-gov
- 00:17:49organization and within the Dominus
- 00:17:50repository users that execute the
- 00:17:53original install sh scripts will
- 00:17:55actually download the zip of the
- 00:17:56attacker and execute the Dominos sales
- 00:17:59clip of the attacker
- 00:18:01this is the proof that we control the
- 00:18:03sgov organization and within it we can
- 00:18:05open the Dominos Repository
- 00:18:08now a third example I'll show you is
- 00:18:10just like the Google scenario of written
- 00:18:12instructions but it's a special case for
- 00:18:14us so I'll show it anyway you can see in
- 00:18:16the written instructions they tell us to
- 00:18:18download an extension Visa X which is
- 00:18:21a vs code extension
- 00:18:23and of course this link is vulnerable to
- 00:18:24repo jacking it's from the releases in
- 00:18:26GitHub and when an attacker will create
- 00:18:28the old organization name Infinity
- 00:18:30repository they will no longer be a
- 00:18:32redirects and users that press this
- 00:18:35download link will actually download the
- 00:18:37attacker's Discord extension now
- 00:18:40actually this repository is what led us
- 00:18:43a research to understand what are the
- 00:18:45dangers of installing a malicious
- 00:18:46vehicle extensions any dangers and the
- 00:18:49flaws in the marketplace that we've
- 00:18:50shown before
- 00:18:52in order for an attacker to exploit this
- 00:18:55broadly he needs to know the previous
- 00:18:56names of repositories for that he can
- 00:18:59use the gh1 projects this project
- 00:19:01records all public activities
- 00:19:04on a public repository like commits and
- 00:19:07pull requests this is a gold mine for
- 00:19:09researchers
- 00:19:10and attackers you can see here in the of
- 00:19:14the data set there are specific download
- 00:19:15links of a specific years and months
- 00:19:18each link here contains millions of
- 00:19:21repositories
- 00:19:22so what would we do with this
- 00:19:23information nothing beats a good
- 00:19:25statistic charts we took a random month
- 00:19:27June 2019 and restarted all the
- 00:19:30repositories name from there that
- 00:19:31amounted to 125 million unique
- 00:19:34repositories
- 00:19:35from that we took a random sample of one
- 00:19:37percent which is 1.25 million
- 00:19:40repositories eject each one if it is
- 00:19:42vulnerable to repo jacking and the
- 00:19:44result
- 00:19:45approximately 37 000 repositories
- 00:19:48available to repo jacking that is almost
- 00:19:50three percent
- 00:19:51if you apply this stat on the entire
- 00:19:53GitHub out of 100 repositories out there
- 00:19:56three of them are vulnerable to repo
- 00:19:58jacking and we have a way to find the
- 00:19:59previous name using these data sets we
- 00:20:02disclosed our findings to various
- 00:20:04companies of the examples we saw here
- 00:20:06and many many more remember thanks to
- 00:20:09the data sets if you change your name
- 00:20:11anytime in the past an attacker can't
- 00:20:13find your old name and explore it and
- 00:20:15change references
- 00:20:17that being said we have a few
- 00:20:19mitigations recommendations we'd like to
- 00:20:20suggest check all the GitHub links in
- 00:20:23your code now
- 00:20:25and periodically you may never know when
- 00:20:28a go model for example might change
- 00:20:30their name
- 00:20:31do you want to change organization M
- 00:20:33sure do it but also keep it just as a
- 00:20:36place over there so antaki won't be able
- 00:20:38to acquire it and exploit and change
- 00:20:39references
- 00:20:41do you want to sell it for vulnerable
- 00:20:43repositories here is a little tip there
- 00:20:45is a high possibility of findings that's
- 00:20:47vulnerable repositories around
- 00:20:48Acquisitions and mergers when they
- 00:20:51rename the organization
- 00:20:53okay we've finished with the ID phase
- 00:20:56and the sem phase and now we're moving
- 00:20:58on to the registry phase so yeah
- 00:21:01okay in this phase we will demonstrate
- 00:21:04use vulnerability that we found on npm
- 00:21:05and was fixed by there this
- 00:21:07vulnerability will demonstrate you the
- 00:21:08risk for developer so what is package
- 00:21:11planting in the past npm registry allow
- 00:21:14any user to add any other user as the
- 00:21:16new as the new owner of malicious
- 00:21:18packages
- 00:21:19and as you can see here first of all
- 00:21:21attacker upload Alicia's package and
- 00:21:22then he add another user in which is the
- 00:21:25new maintenance of the malicious packet
- 00:21:26and this is really simple Vector that
- 00:21:29could be done via the npm CLI first of
- 00:21:31all attacker use npm publish in order to
- 00:21:33publish the package then attack any user
- 00:21:36A Wish For example popular profile like
- 00:21:39npm and Facebook profile and of course
- 00:21:41after this attacker remove himself in
- 00:21:44order to make the package seem to be
- 00:21:45more innocent
- 00:21:47and this is how the malicious landing
- 00:21:49page of the package will look like as
- 00:21:51you can see if you or any other
- 00:21:53developer in your organization somehow
- 00:21:55encountered this fancy malicious packet
- 00:21:57you might be full into installing it
- 00:21:58because it seemed to be owned by user
- 00:22:00with a lot of reputation in the platform
- 00:22:03and it was also possible via the npm
- 00:22:06website to add another user but the
- 00:22:08reason why I'm showing it here is there
- 00:22:10is another issue some of you may notice
- 00:22:12that when attackers try to add another
- 00:22:14user as the new owner of his malicious
- 00:22:16packet you will get their 2fa status so
- 00:22:19we have two information disclosed
- 00:22:21of course we write a wrote a script that
- 00:22:24did this for us and we get a lot of 2fa
- 00:22:26status of many popular maintainers on
- 00:22:29npm and we get really interesting
- 00:22:32statistics about the 2fa status of
- 00:22:34direct maintainer and indirect
- 00:22:37maintenance of popular packages
- 00:22:39we report our fighting to npm which say
- 00:22:42they act they tracking this issue
- 00:22:44internally and they actively working on
- 00:22:46fixing it and after some month they
- 00:22:48release a patch a confirmation mechanism
- 00:22:50so now it's no longer possible and if
- 00:22:53you want to add another user as the
- 00:22:54owner of your package an email will be
- 00:22:57sent to their email address and they
- 00:22:58need to approve it first
- 00:23:00there are some lessons that you can
- 00:23:02learn from the currency from the current
- 00:23:03issue first of all if you are using npn
- 00:23:06it might be a good idea to check that
- 00:23:08all the packages under your scope really
- 00:23:10belong to your scope because this Vector
- 00:23:12was possible in the past and you need to
- 00:23:15be always suspicious about the ownership
- 00:23:17of your about the owners of your
- 00:23:19dependency now I know it sounds obvious
- 00:23:21and it's easier said than done so what
- 00:23:23you can do in order to achieve this
- 00:23:25first of all you can evaluate open
- 00:23:27source project by using different
- 00:23:28sources that are available today lag
- 00:23:31devdaps and socket Dev that actually
- 00:23:33give you security ranking of different
- 00:23:34open source project and you can also use
- 00:23:37browser extension that do this thing for
- 00:23:39us and actually and actually collect
- 00:23:42data from different sources
- 00:23:44okay we are on the cicd phase here we
- 00:23:48will show you vulnerability that you
- 00:23:49found on traffic CI that could put at
- 00:23:52risk 10 of thousand of open source
- 00:23:53project so
- 00:23:55our research began after we realized
- 00:23:57there had been a huge increase among
- 00:23:59different CI providers over there if you
- 00:24:01think about it in the past Jenkins and
- 00:24:04Travis were the only available CI tools
- 00:24:06but now we have GitHub action Circle CI
- 00:24:09Azure Pipeline and more and we start to
- 00:24:11notice that many open source projects
- 00:24:13start to migrate between both different
- 00:24:14CI providers and sometimes it's possible
- 00:24:17to find user to this they decide to move
- 00:24:20from Travis to GitHub action for example
- 00:24:22and in is all the infrastructure on
- 00:24:25Travis to find some secret data
- 00:24:28after we read a great article about
- 00:24:30eight flow about similar issue and we
- 00:24:33decided took our research one step
- 00:24:35further and actually we found a lot of
- 00:24:36token of popular projects
- 00:24:38while researching the API of Travis we
- 00:24:41found that actually one of the API
- 00:24:43Travis is vulnerable to idle which means
- 00:24:45attacker could actually get any public
- 00:24:47log that ever exists in Travis API and
- 00:24:50within this log actually to search for
- 00:24:53secrets and this is how it's look it's
- 00:24:55really simple all attackers you need to
- 00:24:56do is change the sequence number and
- 00:24:58then it will get instant random build
- 00:25:00number it build output and we found
- 00:25:04actually that there are more than 770
- 00:25:07Millions available logs of different
- 00:25:08projects but we must admit that not all
- 00:25:12the log in this range were available so
- 00:25:14we keep our research and found another
- 00:25:16API of traffic is available to idle this
- 00:25:19time there are two interesting part
- 00:25:20about this issue first of all these
- 00:25:23sequence numbers start from 1 and it
- 00:25:25will then it will it will really direct
- 00:25:28us to some S3 bucket and this will be
- 00:25:32the exact same logs as we found in the
- 00:25:34first method but now logs that we found
- 00:25:38in the first method and were accessible
- 00:25:39now have become available so we managed
- 00:25:42to bypass their restriction and expand
- 00:25:45our attack surface
- 00:25:47and like the repo jacking research we
- 00:25:49like a lot of data so because we lazy we
- 00:25:51decided to took only one percent of the
- 00:25:53available log which sell up to around 8
- 00:25:56million slogs and then run different
- 00:25:58scanning tools and our own word list and
- 00:26:01then we saw the price we got a lot of
- 00:26:03token that related to really popular
- 00:26:05platform like GitHub AWS Docker app some
- 00:26:08of the token that we found related to
- 00:26:10project with ten of thousands of GitHub
- 00:26:12actually form only one percent of the
- 00:26:15log we found more than 73 000 of
- 00:26:17different token
- 00:26:19and in the chat if one of you you can
- 00:26:21see the diversity of the token that we
- 00:26:23found a lot of token for defense usages
- 00:26:25and it's really important to say that
- 00:26:27not all the token are equal and some
- 00:26:29exposure and danger more than other
- 00:26:32in order to understand how to use this
- 00:26:35token we use the clear X project that
- 00:26:37contain a lot of token and the related
- 00:26:38API and this helps us to know how to
- 00:26:40verify those token
- 00:26:44of course Travis tried to censor some of
- 00:26:46the token that we found by the diversity
- 00:26:48of the token and the log where too much
- 00:26:50to handle you can see that only for
- 00:26:52GitHub token we found more than 20
- 00:26:54different aliases
- 00:26:56okay so let's connect all we have here
- 00:26:59we had a lot of token that anyone can
- 00:27:01access a way to access a restriction
- 00:27:04logs and a poor rate limiting process so
- 00:27:07we get it a really dangerous and
- 00:27:09critical situation
- 00:27:11we import our finding to avci which
- 00:27:13which responded that this issue is by
- 00:27:15Design and they do not intend to fix it
- 00:27:17great for us and of course after our
- 00:27:21research was widely published Travis
- 00:27:23start mitigate the risk and deleted the
- 00:27:24logs we also report our filing to a
- 00:27:27respective service provider all of them
- 00:27:29were aligned and initiated y key
- 00:27:30rotation and other verified that at
- 00:27:32least 50 percent of our findings were
- 00:27:35still valid so what we can learn from
- 00:27:37the current issue
- 00:27:38first of all it might be a good idea to
- 00:27:40delete any Legacy or old component that
- 00:27:43you have in or in your infrastructure
- 00:27:45because sometimes it can contains logs
- 00:27:47and regardless logs it's important to
- 00:27:50rotate them periodically some of the
- 00:27:52token that we found were 70 years old
- 00:27:55it's also important to give your third
- 00:27:57party token the only privilege they need
- 00:27:59and it might be a good idea to scan any
- 00:28:02output from your development flow or
- 00:28:04from any CI that you have with secret
- 00:28:06scanning tool and when you do so try to
- 00:28:09use different scanning tools because
- 00:28:11each one of them have their own nuance
- 00:28:13and their own method for example some of
- 00:28:15them use entropy some of them use
- 00:28:17pattern and in order to get fully
- 00:28:19visualization of exposed secrets you
- 00:28:21need to combine them together
- 00:28:23okay now we are on the artifact phase
- 00:28:26here we'll demonstrate the vulnerability
- 00:28:28that we found on npm that can allow
- 00:28:30attacker to disclose private package
- 00:28:32name so first of all what is private
- 00:28:34package on npm npm registry allow user
- 00:28:37to upload to the public npm registry
- 00:28:39private package these packages is only
- 00:28:42available to to specific numbers of user
- 00:28:44and organizations and as their name
- 00:28:46suggests the content and their name
- 00:28:49should not be available for anyone the
- 00:28:51name of private package must consist of
- 00:28:53two parts first of all the username aka
- 00:28:56the scope and then the private package
- 00:28:59name
- 00:29:00and what is timing attack when we refer
- 00:29:03to timing attack we refer to a method
- 00:29:05for a for attacker to disclose sensitive
- 00:29:08data from the server only by observing
- 00:29:10the they took the server to respawn for
- 00:29:12different input here for example
- 00:29:14attacker could only by observing the
- 00:29:16time they took the npm API to respond
- 00:29:19for specific metadata of of private
- 00:29:22package to figure if the package exists
- 00:29:24or not
- 00:29:25so how npm is vulnerable to timing
- 00:29:28attack
- 00:29:28let's assume that attackers want to
- 00:29:30query npm API for a specific package
- 00:29:33that called Secrets package of an
- 00:29:35organization that called random
- 00:29:36organization
- 00:29:37of course if he will try to do this as
- 00:29:39Anonymous user it will not get any
- 00:29:42result in 404 but the interesting part
- 00:29:45is not the 4004 and there has no any
- 00:29:48data about this package the interesting
- 00:29:51part is the time they took the server to
- 00:29:53respond
- 00:29:54in our research we found that if
- 00:29:55attackers make around 5 requests in a
- 00:29:58row it's possible to determine if the
- 00:30:00package exists or not basically if the
- 00:30:02package exists the respawn time will be
- 00:30:05longer and if the package doesn't exist
- 00:30:07the respawn time will be shorter and
- 00:30:09will decrease over time because some
- 00:30:11caching mechanism on npm and if you want
- 00:30:14more specific data in our research we
- 00:30:16found that if the package exists and you
- 00:30:18try to query npm API for specific
- 00:30:21private package the server will respond
- 00:30:23after 600 milliseconds and if the
- 00:30:25package doesn't exist the respond time
- 00:30:27will be under 100 millisecond
- 00:30:31so our attacker can use this attack
- 00:30:34let's assume that attacker by using this
- 00:30:36method find a private package that
- 00:30:37called a low ward of an organization
- 00:30:39that's called an e-test.org what attack
- 00:30:42you will try to do is to figure out if
- 00:30:44there is another package under the
- 00:30:46public npm registry without the scope in
- 00:30:50order to take other developer that
- 00:30:52forget to mention the scope of the
- 00:30:53package
- 00:30:54but in order to deeply understand this I
- 00:30:57want to give an example from another
- 00:30:58platform Docker Hub if you know Docker
- 00:31:01app you know that when you try to upload
- 00:31:03Docker image the name of Docker image
- 00:31:05must consist of two parts first of all
- 00:31:08the username and then the image name and
- 00:31:11attacker or anyone cannot upload an
- 00:31:14image without a scope the only one that
- 00:31:16could do it in Docker app is actually
- 00:31:18the docker app team themselves so we
- 00:31:20have scenario that is possible in npm
- 00:31:22but it's not possible in Docker app and
- 00:31:25this lead us to our first takeaway here
- 00:31:26we need to unified security standard
- 00:31:28between different registry on the supply
- 00:31:31chain space because each one of them
- 00:31:33have their own nuance and mitigations
- 00:31:35and then PM have a lot of them but if we
- 00:31:38will combine all of them as Community we
- 00:31:40actually improve the overall security of
- 00:31:42the supply supply chain space
- 00:31:45okay we disclose our finding to npm team
- 00:31:48and which responded because some
- 00:31:50architectural limitation they cannot
- 00:31:52prevent such attack so it's still
- 00:31:54possible and they even exclude this from
- 00:31:56the their back Bounty program but the
- 00:32:00mitigation here is very simple all that
- 00:32:02new users need to do in order to
- 00:32:03mitigate the rescue is to create place
- 00:32:05order package under the public npm
- 00:32:07registry
- 00:32:08and if you want to read more about other
- 00:32:11attack Vector that you related to this
- 00:32:13issue there is a really great blog by
- 00:32:15npmting npm avoiding substitution
- 00:32:18attacks and a security researcher it's
- 00:32:20always a good idea to check for timing
- 00:32:22attack in other platforms
- 00:32:24so let's sum up all the points that we
- 00:32:27have here we've shown you a lot of
- 00:32:28different examples for different phases
- 00:32:30we have talked about IDE extension about
- 00:32:33repo jacking package planting tokens on
- 00:32:36cicds and even our attacker can find
- 00:32:40your private package on npm if you think
- 00:32:42about it each of the example were really
- 00:32:45simple but their consequences might be
- 00:32:48catastrophical for some organizations
- 00:32:51you need to ensure security at each
- 00:32:53stage of the development flow we've
- 00:32:55shown you many mitigations for different
- 00:32:57risks but sometimes they will very
- 00:33:00specific to the research description
- 00:33:01here on this college for example you
- 00:33:03need to understand how your organization
- 00:33:05fits inside this development flow and do
- 00:33:08threat modeling to understand the
- 00:33:09different risks that you are exposed to
- 00:33:12are you a security researcher be careful
- 00:33:15if the pocs that you upload do you
- 00:33:18remember the CTX incident a security
- 00:33:20researcher uploaded a malicious python
- 00:33:23package to pewpie stealing environment
- 00:33:25variables after there was a lot of
- 00:33:27traffic regarding this message package
- 00:33:29he uploaded a blog post that says do not
- 00:33:31worry I'm a security researcher not a
- 00:33:34malicious actor I do not intend to do
- 00:33:36anything with your secrets and I deleted
- 00:33:39them
- 00:33:39now of course no one can believe
- 00:33:42anything he says and now all the
- 00:33:44organizations need to rotate the secrets
- 00:33:46and the security evaluations to
- 00:33:48understand if they were bleached by
- 00:33:50using these secrets
- 00:33:52as a security researcher you need to
- 00:33:54understand when you upload the POC to
- 00:33:56npm pupil or even the marketplace of
- 00:34:00this code you don't Target a single user
- 00:34:02or a single company you target the whole
- 00:34:04open source community so things go out
- 00:34:06of hand very easily you need to be very
- 00:34:09careful
- 00:34:10and our last point if you think about it
- 00:34:14all the security researchers and the
- 00:34:16open source Community when we speak
- 00:34:17about vulnerabilities and attack vectors
- 00:34:19that related to supply chain they are
- 00:34:22only focused on popular platform like
- 00:34:23npm go and pewpie but there are so many
- 00:34:27other registry that sometimes vulnerable
- 00:34:29to the same issue but currently they do
- 00:34:32not get any attention from anyone and
- 00:34:34they can expose a lot of organization to
- 00:34:36supply chain attacks
- 00:34:37thanks for listening everyone if you
- 00:34:39have any questions feel free to contact
- 00:34:41us there or right now
- 00:34:43thank you
- 00:34:44[Applause]
- supply chain
- vulnerabilities
- open source
- security
- npm
- repo jacking
- malicious packages
- CI/CD
- development flow
- best practices