AvenseTechעבריתBook a short call

AI in practice · 5 min read

An AI-Built System Got Hacked: How We Made It Secure and Fast

A Miami cosmetics chain built its system with AI. After a breach and a fake email in the CEO's name, they came to us. Here's how we stopped the leak, cleaned up the exposure and rebuilt it.

An AI-Built System Got Hacked: How We Made It Secure and Fast

The staff got an email in the CEO's name. It asked them to send a payment to a new bank account, and it looked completely real. They sent the money, and the account belonged to an attacker.

This happened to a cosmetics chain in Miami after it built its own system with AI tools, customer portal included. The build went fast and the system worked, but nobody checked the security or the code. Before that email ever arrived, the attacker had already taken the customers' credit card details from the system.

We work with AI every day, and building with AI is a great way to get to a working product fast. This story shows what has to be added before a system like that starts holding customers' money and data, and how we did it for this client.

How the attacker got in

When we checked the system, we saw how he got in. The code the AI wrote worked, but the database access rules were never set. Anyone who knew where to look could pull data without logging in.

This is a known problem in AI-built systems. In 2025 a security researcher scanned 1,645 apps built on a popular AI app builder and found the same issue in about 10% of them. In July 2026 Veracode reported that in about 44% of the tasks it tested, code written by AI models introduced a security flaw. AI writes code that runs, and someone has to check that it's protected too.

What we found inside

Full customer card details were stored inside the system. The client wanted to charge repeat customers without asking for their card every time, which is a real business need. The problem was that anyone who got into the system could take the cards.

The database sat in the cloud with no access rules and no IP blocking, and the system itself was open to the whole world. Nothing filtered traffic before it reached the server. And the app, the API and the database ran on the same server, so breaking into one part gave access to the rest.

Our method: stop, clean, rebuild

In cases like this we work in this order. First we shut the door, then we make sure nothing is left inside that shouldn't be there, and only then do we build.

Stop the leak

On day one we cut public access to the database and set access rules on every table. We rotated every key and password and dropped every active session. We locked the admin side so only the business's own IP addresses could reach it, and put the system behind Cloudflare, with a firewall and rate limiting.

Clean up the exposure

We deleted the card data from the system and moved recurring charges to a payment provider that keeps the card on its side and gives the system only a token. The client still charges repeat customers exactly as before, and the system no longer holds a single card number. We scanned the code and its history for keys forgotten in files, and went through the logs to understand what was exposed and make sure the attacker had no way back in.

Against the fake emails, we set up SPF, DKIM and DMARC on the domain, so it's much harder to send email in the company's name. We turned on two-factor authentication for every employee and agreed on one rule with them: bank detail changes are confirmed by a phone call, not by email.

Rebuild

Three people from our team worked on the rebuild, including a DevOps engineer. We split the servers: today there's a server for the API and a separate server for the database, which accepts connections only from the API server and not from the internet. We fixed deployment, so every change goes through a proper process before it reaches the live system, and we sped up the screens that loaded slowly.

We also found functions that looked fine. The client got the business result they expected from them, but the code behind them was broken and failing without anyone noticing. We rewrote them.

What the client got

The same system the staff already knew, with the same screens and workflows. The AI did good work on the design and the first build, and there was no reason to throw it away.

What changed is underneath. There's no card data in the system and recurring charges still work, the database and admin side are closed to the world, and a protection layer sits in front of separate servers. The system is faster, the functions work on the inside too, and the staff know what to do when an email asks for money. What had already leaked couldn't be taken back, but the business now runs on a system it can trust.

Built a system with AI? Four questions to check this week

Before your system holds customers' data or money, answer four questions. Can anyone read your database without logging in? Try it with two test users and see whether one can see the other's data. Where do your keys live, and do they show up in the code the browser downloads? Are you storing card details in the system? And who can reach your admin area?

If any of them is unclear, talk to us. We'll go through the system with you and tell you what to close first.

FAQ

Do I need to throw away a system built with AI and start over?
Usually not. Here we kept the screens and workflows and rebuilt the security, the servers and the code that didn't work.

Is AI the problem?
The AI built a system that works, and that's a big part of the job. What was missing was the check an experienced developer runs before a system meets customers.

Who does this kind of work?
A development team with experience in security and infrastructure. Here, three people from our team worked on it, including a DevOps engineer, and for any system the team size depends on what the check finds.

AvenseTech

Need a development team
or a managed project?

Experienced developers, at 25%–40% savings compared with local hiring.

Book a short call

Tell us
what you need.

A role missing from your team, a project that needs someone to manage it, or an idea without a team.

  1. 01We'll get back to you within one business day.
  2. 02A short call about what you need.
  3. 03You get a formal proposal.
[email protected]

Leave your details

It takes two minutes. We reply within one business day.

We use your details only to get back to you, as described in our Privacy Policy. This site is protected by reCAPTCHA; see the Google Privacy Policy and Google Terms of Service.