AI MSP cyberattacks: Defending MSP tools in a post-AI world

In today’s threat landscape, MSPs must defend themselves against AI-powered cyberattacks. In this blog, we’ll look at the emerging threats against MSPs and what strategies can be used to defend against this new category of threat actors.

Background

Since LLM technology first became mainstream, there have been concerns about the cybersecurity implications. Since the release of ChatGPT in 2022, tools have been created that do end-to-end pentesting (aka cyberattacks). This might seem a bit ethereal to the average person, especially since most LLM tools used on a daily basis have safeguards built in:

As a WAF provider, we were initially curious about this after noticing OpenAI and other providers starting to index MSP tools (just like a search engine spider). From a security perspective, we view such enumeration negatively, as it is the first phase of a cyberattack. We wrote WAF rules to block AI bots to prevent indexing, and moved on to other things.

We later noticed a trend: our AI search spider rules were blocking requests that appeared to be actual exploit attempts, and other rules were blocking attacks from specialized AI bots. At this point, we decided to investigate the threat landscape and the effectiveness of our own products with some real-world testing. The results were quite interesting.

MSP AI cyberattack threat testing methodology

When trying to cut through the ethereal and get to the heart of the technology, it can be a challenge. Ultimately, there are a variety of tools out there, with different levels of maturity, required setup, etc. After a failed attempt at getting PentestGPT configured, we landed on a very simple setup using the following tools:

  • OpenCode (a command-line development tool that integrates with various LLMs)
  • opencode-pentester (a set of AI agents/etc. for OpenCode that does the end-to-end attacking)
  • OpenRouter – a multi-LLM platform that we used to connect OpenCode to our AI of choice (in this case, it’s  DeepSeek V4 Flash 0731 )

All the software is open source, and DeepSeek is a very low-cost model. This stack was deployed on a basic Ubuntu VPS with modest resources. We opted for this arrangement since we think it best resembles what threat actors would use for AI-powered cyberattacks (and if the low-cost models are effective at exploiting systems, it stands to reason that the advanced models would be too).

We did a series of tests, and the results are as follows.

TestComplete takeover by AI?Critical FindingsTotal findings
Pre-test (no WAF)Yes213
Blackbox (attack WAF via IP)No04
Greybox 1.0 (attack WAF via URL)Yes110
Bigbox WAF (CloudFlare free tier)Yes316
Greybox 2.0 (attack WAF with anti-AI rules)No05

AI against a known vulnerable system

As a pre-test, we set up our AI-powered cyberattack stack against a defenseless instance of the DVAPI. This is a training API for pentesting and contains a number of vulnerabilities. As expected, the bot was able to exploit the system. The assessment identified 13 total findings (2 critical, 2 high, 4 medium, 4 low, and one informational):

IDSeverityTitleCVEToolStatus
316criticalNoSQL injection – authentication bypass on /api/loginnone applicablemanualexploited
322criticalSSRF via /api/addNoteWithLink – arbitrary URL fetch incl. cloud metadata & localhostnone applicablemanualexploited
315highBroken Authentication – weak JWT secret (secret123) allows token forgery / privilege escalationnone applicablehashcat/manualexploited
321highBOLA/IDOR – read other users’ private notes via /api/getNote (user-supplied username)none applicablemanualexploited
314mediumVerbose error handling exposes stack traces + flag (Sever Misconfiguration)none applicablemanualconfirmed
317mediumCleartext HTTP – no TLS/HTTPS (credentials & JWT tokens transmitted in plaintext)none applicabletestsslconfirmed
323mediumMissing rate limiting & account lockout on authentication (login brute-force permitted)none applicablemanualconfirmed
324mediumNoSQL operator injection in /api/getticket ticketno parameternone applicablemanualconfirmed
313lowSwagger UI / API documentation exposed without authenticationnone applicablemanualconfirmed
318lowMissing security headers on application pagesnone applicableniktoconfirmed
319lowNon-standard 404 handling – catch-all HTTP 200 for unknown pathsnone applicableffufconfirmed
320infoFramework fingerprinting via X-Powered-By: Expressnone applicablecurlconfirmed
325lowUser enumeration via /api/register (username already registered response)none applicablemanualconfirmed

As you can see, all the buzz about AI-powered cyberattacks has some substance to it – the bot was able to identify that this was a DVAPI deployment, find working credentials, and perform a number of exploits. It was able to perform a complete takeover of the vulnerable system – establishing that the bot is a capable actor.

Output from the AI bot. It shows both the tool outputs and the bot’s reasoning process.

AI against a black-box WAF

When it comes to pentesting, different levels of information are given to replicate different threats. In our use case (external threat actor trying to mass-exploit systems on the Internet), we opted for a black-box test on the assumption that MSPs won’t be sharing their defense tactics with threat actors.

By default, the Automation Theory Reverse Proxy as a Service with WAF is configured to prevent enumeration on the Internet – so only the public IP would be known by an IoT scanner (no details about the application, underlying server, etc. can be determined). We gave the bot the IP of one of our test instances and ran the same test. The assessment identified 4 total findings (0 critical, 0 high, 1 medium, 1 low, 2 informational)

IDSeverityTitleCVEToolStatus
29mediumTLS hostname mismatch: certificate CN=*.<REDACTED>.com does not match hostname <REDACTED>none applicableniktoconfirmed
24infoReverse proxy service identified via TLS cert (CN=*.<REDACTED>.com)none applicablenmapconfirmed
25lowTLS 1.2 CBC ciphers enabled (LUCKY13 / CVE-2013-0169)CVE-2013-0169testssl.shconfirmed
26infoReverse proxy returns 503 for all paths/methods (no backend, no reachable application)none applicablecurlconfirmed

The bot flagged that the wildcard certificate didn’t match the IP address, that an older cipher suite was enabled (for compatibility), and otherwise identified that it was talking to a reverse proxy. However, it was unable to traverse the reverse proxy, locate the vulnerable application, or exploit it. All of these findings are for the reverse proxy itself, indicating 100% effectiveness in keeping the vulnerabilities away from the AI –  as long as the attacking bot never learns the hostname.

This is the exact result we want in an MSP AI cyberattack scenario. But most MSPs can’t rotate an FQDN that’s been in production for years. So we stress-tested the harder scenario next.

AI cyberattack (1.0) against a grey-box WAF

While a black-box attack scenario is most likely, over the years we’ve seen a real-world trend: attackers scrape lists of infrastructure for domains, and then recycle those domains in future campaigns. For example, we’ve seen campaigns in which bots send WordPress exploits to RMM servers running Windows. The only way we could explain this behavior (which was systematic) is that the attackers were working from historical data (probably trying to exploit MSPs’ public websites). Given this pattern, we wanted to test the effectiveness of the WAF when the attacker knows which application is present and can communicate with the app (in essence, if an AI MSP attacker has the FQDN).

The results were different in an unexpected way. The AI took a different approach, likely due to the presence of the WAF.  The assessment identified 10 total findings (1 critical, 6 high, 3 medium, 0 low, 0 informational). It seemingly decided to play capture-the-flag during this test, highlighting the non-deterministic nature of AI.


#
OWASP API Top 10 (2023)SeverityEndpointRoot Cause
1API1 Broken Object Level Authorization (BOLA)HighGET /api/getNoteNo object-level ownership check on username param
2API2 Broken Authentication (weak JWT)HighPOST /api/login, JWTHardcoded secret123; client-trusted isAdmin claim
3API3 Broken Object Property Level Authorization (BOPLA)HighPOST /api/registerMass-assignment of score at registration
4API4 Unrestricted Resource ConsumptionHighPOST /api/profile/uploadNo upload size limit (≥50 MB triggers flag)
5API5 Broken Function Level Authorization (BFLA)HighDELETE /api/user/<username>No role check; only admin special-cased
6API10 Unsafe Consumption of APIs (NoSQLi in auth)HighPOST /api/loginUnsanitized Mongo operator ($ne) injection
7API7 Server-Side Request Forgery (SSRF)CriticalPOST /api/addNoteWithLinkArbitrary server-side URL fetch; no scheme/host allowlist
8API6 Unrestricted Access to Sensitive Business FlowsMediumPOST /api/addTicketNo rate limiting / anti-automation on ticketing flow
9API8 Security Misconfiguration (verbose errors)Mediumglobal (invalid JWT)Production error handler returns full stack traces + secrets
10API9 Improper Inventory ManagementMediumPOST /api/allChallengesUnreleased/hidden challenges exposed; flag in description

The first interesting factor is that despite the critical vulnerabilities dropping 50%, the total number of high-severity findings grew (which might be an error made by the AI – the NoSQL injection listed as critical in the first test was detected again but classified as a medium-severity finding). We can see that the WAF was blocking malicious payloads, but the AI didn’t offer any observations about it. It created a user account via the registration link on the login page and then performed all the exercises.

Since the AI was able to compromise the application despite the WAF, this was the turning point for our experiment. It became obvious that we needed to enhance the WAF to block non-malicious requests from malicious sources. While most security practitioners lament the potential threat of AI bots, we’ve taken this as a design specification and created a new iteration of our product offering to protect against these threats.

However, one more data point was needed: how do the big-box WAFs handle this type of threat?

AI cyberattack against big-box (Cloudflare) WAF

In a previous blog post, we benchmarked Cloudflare’s WAF, and the free tier (which a number of MSPs use) didn’t perform well. The free tier of Cloudflare is designed for “high severity” threats (think national news headline events, like Heartbleed, Log4J, etc.). This is fine for general-purpose websites, but isn’t adequate for MSP tools.

We tested the free tier of CloudFlare (as we did before). The AI again took a different approach with this scan, detailing 3 critical, 6 high, 6 medium, and one low findings (noting that the previously critical SSRF vulnerability is still classified as a high-severity finding, and the weak JWT is now flagged as critical). The AI was able to perform a full takeover, and looking at the Cloudflare logs, we’re able to see that only 1.06% of the AI bot traffic was actually blocked.

IDSeverityTitleCVEToolStatus
333criticalNoSQL injection in /api/login allows authentication bypasscurlexploitedopen
335criticalWeak JWT HS256 secret allows admin token forgery (Broken Authentication)pythonexploitedopen
347criticalBFLA: DELETE /api/user/:username allows any user to delete arbitrary accounts (Ch5)curlexploitedopen
339highBOLA/IDOR: /api/getNote retrieves arbitrary user’s note via username paramcurlconfirmedopen
340highSSRF in /api/addNoteWithLink fetches arbitrary URLs incl internal servicescurlconfirmedopen
341highBroken Function Level Auth (BFLA): admin-only /api/getticket callable by any usercurlconfirmedopen
343highBOPLA: register allows mass assignment of score and solves (Ch3)curlconfirmedopen
345highNoSQL injection in /api/getticket exposes admin ticket (BFLA Ch5)curlconfirmedopen
348highSSRF to internal flag service on port 8443 via /api/addNoteWithLinkcurlconfirmedopen
334mediumSensitive stack-trace disclosure on /api/profile error handler (flag leak)curlconfirmedopen
337mediumauth session cookie missing HttpOnly/Secure/SameSite flagscurlconfirmedopen
338mediumNo rate limiting / account lockout on /api/logincurlconfirmedopen
342mediumImproper inventory management: unreleased challenges 11-12 exposed (flag leak)curlconfirmedopen
344mediumPublic Swagger UI /api documentation exposed (Ch8 misconfig)curlconfirmedopen
346mediumProfile upload accepts polyglot files; serves raw content as image (Ch4)curlconfirmedopen
336lowMissing security headers (CSP, HSTS, X-Frame-Options, X-Content-Type-Options, Referrer-Policy)curlconfirmedopen
Thousands of malicious AI bot requests not being stopped by the CloudFlare free tier.

Clearly, the free Cloudflare WAF won’t protect against AI MSP cyberattacks.

AI cyberattack (2.0) – robust defenses

The grey-box failure taught us a couple of things. First, AI bots aren’t just using traditional WAF bypass methods; they actually will send legitimate requests and payloads, and systematically test to determine the nature of the defenses. Second, once the AI can authenticate, it doesn’t need to use exploit payloads that WAFs normally block.

We set our sights on creating a system that would solve the general problem of identifying malicious bots. We ended up creating a behavioral scoring system that is an inverse duck test: if it doesn’t look like a duck, swim like a duck, or quack like a duck, it’s not a duck. These rules are designed to identify the bad-but-not-exploit requests and block them.

With that, our post-test with our AI identifying rules has one proxy-layer access control added: the login page is blocked. This resembles common industry practice, and since the DVAPI has a user registration process on the login page, preventing the bot from legitimately signing up creates a more realistic test scenario for us.

We continued to iterate over our rules until we hit two important benchmarks:

  • We prevented a takeover of the application
  • All critical vulnerabilities were mitigated

We were successful in this goal, with our new rules eliminating all critical vulnerabilities and bringing the total number of findings down to 5 (0 critical, 1 high, 3 medium, and 1 low):


ID
SeverityTitleCVEToolStatus
328highNoSQL injection in /api/register username (MongoDB operator injection)none applicablecurlexploited
327mediumVerbose error / stack-trace disclosure on /api/profile invalid JWT leaks absolute paths + flagnone applicablecurlexploited
329mediumUsername enumeration via /api/register NoSQL boolean oraclenone applicablecurlexploited
330mediumMissing rate limiting / no lockout on /api/register (unlimited account creation)none applicablecurlexploited
331lowSecurity header / info-disclosure issues: x-powered-by: Express and permissive CSP with unsafe-inlinenone applicablecurlexploited
Final results of the AI attacks with the enhanced ruleset.

While it might be unnerving that the WAF didn’t stop 100% of attacks, it’s important to remember that no security technology exists in a vacuum. The WAF reduced the total number of vulnerabilities by 62% and prevented the AI bot from breaching the application (even after it tried over 13,000 times to brute-force the authentication token). 

During our final test, the WAF blocked 5,688 malicious requests. Our behavioral scoring accounted for 2,608 of the 5,688 blocked requests — nearly half – on top of everything the existing configuration caught.

Malicious requests sent by the AI bot.
Total WAF hits during the final test with the enhanced rules.
Requests blocked by the enhanced rules.

Defending against MSP AI cyberattacks

For MSPs trying to defend themselves, getting defensive architecture in place before an attack is critical. As much as possible, we want to make the MSP surface area a black box, which was 100% effective in preventing the AI from seeing the vulnerabilities in the underlying application.

We’ve written extensively about this in the past, and our blog post, Defending the MSP Toolstack in a Zero-Day World, details the process. In a nutshell, getting infrastructure between the server and the Internet that can prevent enumeration is critical for creating the black box environment to secure the infrastructure. Many MSPs (with the best of intentions) fall into the trap of “majoring in the minors” and do lots of HTTP header hardening and TLS cipher suite tuning – but never address the issue of the server being naked on the Internet.

A Layer 7 reverse proxy with WAF is the gold standard for such a technology – and once the server is behind the proxy/WAF, access controls (like our login page restriction above) can significantly improve the security posture of the application. 

Even when your MSP isn’t a black box, behavioral scoring will protect against advanced threats. Security has always been a multi-layer endeavor, and we think that a layer like this has a place in the stack of every MSP with on-prem infrastructure.