MCPs: How to Avoid Security Pitfalls

This ad is not shown to multipass and full ticket holders
JS Nation
JSNation 2026
June 11 - 15, 2026
Amsterdam & Online
The main JavaScript conference of the year
Upcoming event
JSNation 2026
JSNation 2026
June 11 - 15, 2026. Amsterdam & Online
Learn more
Bookmark
Rate this content

MCP (Model Context Protocol) has quickly become a standard way to extend LLM functionality in AI-assisted and vibe coding, and developers are early adopters of this powerful new integration method. But MCPs can also create significant risks not just to the code you're writing, but to your workstation, credentials, and company infrastructure. In this lightning talk I will review  those risks using real-world examples, and explain how to avoid them.

This talk has been presented at AI Coding Summit 2026, check out the latest edition of this Tech Conference.

FAQ

MCP stands for Model Context Protocol, an open standard for connecting Large Language Models (LLMs) to external tools and data.

Before installing an MCP, search for the official vendor, check the repository for activity and maintenance, ensure the servers are trusted registries, and review the MCP code for security risks.

Securely configure an MCP by generating specific API keys with the least privilege, setting the AI agent auto-run mode to ask every time, and reviewing the tools and input schema provided by the MCP.

After installing an MCP, review all tools provided by the MCP, disable unused or suspicious tools, and carefully check parameters for potential data leakage before granting permissions.

To remove an MCP, delete it from configuration settings and JSON files, ensure no leftover files or processes remain, revoke any API keys provided, and check Git history for any injected changes.

The recommended auto-run mode setting for AI agents is to ask for approval every time before triggering an MCP, to prevent unauthorized actions.

A checklist for MCP security best practices includes scanning the MCP, using trusted sources, providing scoped APIs, setting auto-run to ask, inspecting and disabling unused tools, checking parameters, and ensuring thorough removal of MCPs after use.

MCP security is important because MCPs can read and write files, access credentials, API keys, and other sensitive information, and perform actions that could be exploited if not properly secured.

In September 2025, a malicious MCP server was discovered when a cloned version of the Postmark MCP was published on npm. A single line of code was added to bcc outgoing emails, resulting in sensitive information being sent to the attacker's email.

Gil Friedman
Gil Friedman
7 min
26 Feb, 2026

Comments

Sign in or register to post your comment.
Video Summary and Transcription
Gil Friedman from Backslash Security discussed MCP security, focusing on the Model Context Protocol and AI assistant security risks like GitHub token exposure in auto run mode. Security measures for MCP usage include setting autorun to ask every time, postmarking MCP incidents, handling malicious servers, safeguarding sensitive information, reviewing and disabling unused tools, requiring permission before triggering actions, removing MCP from environments, and revoking API keys when necessary.

1. Analysis of MCP Security

Short description:

Gil Friedman, Backslash Security, MCP security, Model Context Protocol, AI assistant, security risks, GitHub token, auto run mode.

Hi, thank you for joining. I'm Gil Friedman, field CTO at Backslash Security. Today we're going to talk about MCP security. What should we do before, during, and after we use MCPs? What is MCP? MCP is Model Context Protocol. It's an open standard for connecting LLMs to external tools and data. MCPs connect to our AI assistant. MCPs provide tools, which are all the actions that we can do with the MCPs. These are like our hands and legs.

Why should we care about MCP security? We should care because some of the MCPs can read files, write files, and they have all kind of permissions. Also, they might be exposed to some credentials. Also, they're exposed to some API keys and some files that contain some security context. As they also perform some actions, they can be triggered by our model to do things that we don't want them to do. Let's go over the three stages of MCP lifecycle. Before, during, and after.

Before installing an MCP, we need to search for one. MCPs are listed in all kind of websites. First of all, search for the official vendor where they published MCP. Second, check the repo if it's active, well maintained, and with stars. In addition, some of the AI agents' websites, they recommend about MCPs. Please don't use MCPs from random GitHub repos. Check whether the servers are trusted registries. Don't just copy and paste configuration of MCP and copy and paste it to your environment. On local MCPs that you install them on your environment, you should go over the code to check the code, whether there are security risks. You should check the code for any security risk that might have in these specific MCPs. There are some websites like backslash MCP hub, where you can search for an MCP and it provides you the full security risk for these MCPs. When you download the MCP and now you configure it, and now I need to provide the API key for that MCP, we need to generate the API key. For example, GitHub token. Make sure it's just for a specific repo and read-only, if this is the only thing that you would like the MCP to control and interact with this repo. In most or even all the AI agents, there's very important settings that you should check. This is the auto run mode.

2. Security Measures for MCP Usage

Short description:

Set autorun to ask every time, postmark MCP incident, malicious server, sensitive information, review tools, disable unused tools, permission before triggering actions, remove MCP from environment, API key revocation.

You should set it to ask every time. When you set it to ask every time, the AI agent will ask you every time before it will trigger an MCP to check for your approval. The last thing you want that the tool will run without your review.

Here is a very interesting case study about the postmark MCP incident. In September 2025, that was where the first malicious MCP server was discovered in a while. The attacker published a postmark MCP on npm, which was an almost exact clone of the official postmark MCP. They added one line of code, bcc of all outgoing emails, leading to the silent copying of sensitive information to the attacker's email.

After you install the MCP, it's crucial to review all the tools it provides. Check each tool description and input schema carefully before usage. Disable all unused and suspicious tools to minimize risks. When interacting with the MCP, ensure to provide permission before triggering any actions and remove the MCP entirely from your environment when no longer needed, including API key revocation and cleaning up related files and processes.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

It's a Jungle Out There: What's Really Going on Inside Your Node_Modules Folder
Node Congress 2022Node Congress 2022
26 min
It's a Jungle Out There: What's Really Going on Inside Your Node_Modules Folder
Top Content
The talk discusses the importance of supply chain security in the open source ecosystem, highlighting the risks of relying on open source code without proper code review. It explores the trend of supply chain attacks and the need for a new approach to detect and block malicious dependencies. The talk also introduces Socket, a tool that assesses the security of packages and provides automation and analysis to protect against malware and supply chain attacks. It emphasizes the need to prioritize security in software development and offers insights into potential solutions such as realms and Deno's command line flags.
The State of Passwordless Auth on the Web
JSNation 2023JSNation 2023
30 min
The State of Passwordless Auth on the Web
Passwords are terrible and easily hacked, with most people not using password managers. The credential management API and autocomplete attribute can improve user experience and security. Two-factor authentication enhances security but regresses user experience. Passkeys offer a seamless and secure login experience, but browser support may be limited. Recommendations include detecting Passkey support and offering fallbacks to passwords and two-factor authentication.
5 Ways You Could Have Hacked Node.js
JSNation 2023JSNation 2023
22 min
5 Ways You Could Have Hacked Node.js
Top Content
The Node.js security team is responsible for addressing vulnerabilities and receives reports through HackerOne. The Talk discusses various hacking techniques, including DLL injections and DNS rebinding attacks. It also highlights Node.js security vulnerabilities such as HTTP request smuggling and certification validation. The importance of using HTTP proxy tunneling and the experimental permission model in Node.js 20 is emphasized. NearForm, a company specializing in Node.js, offers services for scaling and improving security.
Content Security Policy with Next.js: Leveling Up your Website's Security
React Summit US 2023React Summit US 2023
9 min
Content Security Policy with Next.js: Leveling Up your Website's Security
Top Content
Watch video: Content Security Policy with Next.js: Leveling Up your Website's Security
Lucas Estevão, a Principal UI Engineer and Technical Manager at Avenue Code, discusses how to implement Content Security Policy (CSP) with Next.js to enhance website security. He explains that CSP is a security layer that protects against cross-site scripting and data injection attacks by restricting browser functionality. The talk covers adding CSP to an XJS application using meta tags or headers, and demonstrates the use of the 'nonce' attribute for allowing inline scripts securely. Estevão also highlights the importance of using content security reports to identify and improve application security.
How React Applications Get Hacked in the Real-World
React Summit 2022React Summit 2022
7 min
How React Applications Get Hacked in the Real-World
Top Content
How to hack a RealWorld live React application in seven minutes. Tips, best practices, and pitfalls when writing React code. XSS and cross-site scripting in React. React's secure by default, but not always. The first thing to discover: adding a link to a React application. React code vulnerability: cross-site scripting with Twitter link. React doesn't sanitize or output H ref attributes. Fix attempts: detect JavaScript, use dummy hashtag, transition to lowercase. Control corrector exploit. Best practices: avoid denialist approach, sanitize user inputs. React's lack of sanitization and output encoding for user inputs. Exploring XSS vulnerabilities and the need to pretty print JSON. The React JSON pretty package and its potential XSS risks. The importance of context encoding and secure coding practices.
Let Me Show You How React Applications Get Hacked in the Real-World
React Advanced 2021React Advanced 2021
22 min
Let Me Show You How React Applications Get Hacked in the Real-World
Top Content
React's default security against XSS vulnerabilities, exploring and fixing XSS vulnerabilities in React, exploring control characters and security issues, exploring an alternative solution for JSON parsing, and exploring JSON input and third-party dependencies.

Workshops on related topic

Hands-On Workshop: Introduction to Pentesting for Web Apps / Web APIs
JSNation US 2024JSNation US 2024
148 min
Hands-On Workshop: Introduction to Pentesting for Web Apps / Web APIs
Featured Workshop
Gregor Biswanger
Gregor Biswanger
In this hands-on workshop, you will be equipped with the tools to effectively test the security of web applications. This course is designed for beginners as well as those already familiar with web application security testing who wish to expand their knowledge. In a world where websites play an increasingly central role, ensuring the security of these technologies is crucial. Understanding the attacker's perspective and knowing the appropriate defense mechanisms have become essential skills for IT professionals.This workshop, led by the renowned trainer Gregor Biswanger, will guide you through the use of industry-standard pentesting tools such as Burp Suite, OWASP ZAP, and the professional pentesting framework Metasploit. You will learn how to identify and exploit common vulnerabilities in web applications. Through practical exercises and challenges, you will be able to put your theoretical knowledge into practice and expand it. In this course, you will acquire the fundamental skills necessary to protect your websites from attacks and enhance the security of your systems.
0 to Auth in an hour with ReactJS
React Summit 2023React Summit 2023
56 min
0 to Auth in an hour with ReactJS
WorkshopFree
Kevin Gao
Kevin Gao
Passwordless authentication may seem complex, but it is simple to add it to any app using the right tool. There are multiple alternatives that are much better than passwords to identify and authenticate your users - including SSO, SAML, OAuth, Magic Links, One-Time Passwords, and Authenticator Apps.
While addressing security aspects and avoiding common pitfalls, we will enhance a full-stack JS application (Node.js backend + React frontend) to authenticate users with OAuth (social login) and One Time Passwords (email), including:- User authentication - Managing user interactions, returning session / refresh JWTs- Session management and validation - Storing the session securely for subsequent client requests, validating / refreshing sessions- Basic Authorization - extracting and validating claims from the session token JWT and handling authorization in backend flows
At the end of the workshop, we will also touch other approaches of authentication implementation with Descope - using frontend or backend SDKs.
OWASP Top Ten Security Vulnerabilities in Node.js
JSNation 2024JSNation 2024
97 min
OWASP Top Ten Security Vulnerabilities in Node.js
Workshop
Marco Ippolito
Marco Ippolito
In this workshop, we'll cover the top 10 most common vulnerabilities and critical security risks identified by OWASP, which is a trusted authority in Web Application Security.During the workshop, you will learn how to prevent these vulnerabilities and develop the ability to recognize them in web applications.The workshop includes 10 code challenges that represent each of the OWASP's most common vulnerabilities. There will be given hints to help solve the vulnerabilities and pass the tests.The trainer will also provide detailed explanations, slides, and real-life examples in Node.js to help understand the problems better. Additionally, you'll gain insights from a Node.js Maintainer who will share how they manage security within a large project.It's suitable for Node.js Developers of all skill levels, from beginners to experts, it requires a general knowledge of web application and JavaScript.
Table of contents:- Broken Access Control- Cryptographic Failures- Injection- Insecure Design- Security Misconfiguration- Vulnerable and Outdated Components- Identification and Authentication Failures- Software and Data Integrity Failures- Security Logging and Monitoring Failures- Server-Side Request Forgery
How to Build Front-End Access Control with NFTs
JSNation 2024JSNation 2024
88 min
How to Build Front-End Access Control with NFTs
WorkshopFree
Solange Gueiros
Solange Gueiros
Understand the fundamentals of NFT technology and its application in bolstering web security. Through practical demonstrations and hands-on exercises, attendees will learn how to seamlessly integrate NFT-based access control mechanisms into their front-end development projects.
Finding, Hacking and fixing your NodeJS Vulnerabilities with Snyk
JSNation 2022JSNation 2022
99 min
Finding, Hacking and fixing your NodeJS Vulnerabilities with Snyk
Workshop
Matthew Salmon
Matthew Salmon
npm and security, how much do you know about your dependencies?Hack-along, live hacking of a vulnerable Node app https://github.com/snyk-labs/nodejs-goof, Vulnerabilities from both Open source and written code. Encouraged to download the application and hack along with us.Fixing the issues and an introduction to Snyk with a demo.Open questions.
Bring Code Quality and Security to your CI/CD pipeline
DevOps.js Conf 2022DevOps.js Conf 2022
76 min
Bring Code Quality and Security to your CI/CD pipeline
Workshop
Elena Vilchik
Elena Vilchik
In this workshop we will go through all the aspects and stages when integrating your project into Code Quality and Security Ecosystem. We will take a simple web-application as a starting point and create a CI pipeline triggering code quality monitoring for it. We will do a full development cycle starting from coding in the IDE and opening a Pull Request and I will show you how you can control the quality at those stages. At the end of the workshop you will be ready to enable such integration for your own projects.