
Key takeaways
- AI coding tools build working software fast, but they do not guarantee that it is secure.
- The most common holes are exposed secret keys, missing database access rules and checks that only happen in the browser.
- Attackers use automated scanners, so even small Kenyan business sites are found and tested within days.
- Review, scan and test every AI-built app before launch, and keep it updated afterwards.
In this guide
AI coding tools and website builders now let anyone create a working app, online shop or company website in hours. That is great for Kenyan startups and SMEs, but it has created a new problem: thousands of AI-generated sites and apps are going live without anyone checking whether they are secure. Attackers know this and actively hunt for them. Here is how AI-built software gets hacked and what you can do about it.
Why AI-generated software is a target
- It works, so people assume it is safe. AI tools focus on making features work; security is often an afterthought unless someone asks for it and checks it.
- Owners may not read the code. Non-developers cannot easily spot a dangerous setting or an exposed key.
- Similar patterns repeat. Many AI-built apps share the same templates, so one known weakness can be tested across thousands of sites automatically.
- Speed beats review. Apps go from idea to launch in a day, skipping the testing stage that traditional projects include.
10 common ways AI-built sites and apps are hacked
1. Exposed secret keys
API keys for payment gateways, M-Pesa Daraja, email services or AI providers are sometimes placed in browser code or public repositories. Anyone can open the browser developer tools, copy the key and run up charges or steal data.
2. Missing database access rules
Many AI-built apps connect the browser directly to a cloud database. If row-level security or access rules are missing or too loose, any visitor can read, change or delete every customer record.
3. Security checks only in the browser
Hiding an “Admin” button or checking a user’s role in the front end does nothing if the server does not check again. Attackers call the server directly and skip the interface.
4. Broken access control (IDOR)
Changing an order or invoice number in the web address, such as /orders/1045 to /orders/1046, should not show someone else’s order. In poorly checked apps, it does.
5. Injection attacks
SQL injection and cross-site scripting (XSS) happen when user input is placed into database queries or web pages without proper validation and escaping.
6. Outdated, vulnerable or fake packages
AI tools may suggest old libraries with known vulnerabilities, or even invent package names that do not exist. Attackers register those invented names with malicious code, a trick known as “slopsquatting”.
7. Prompt injection in AI features
Chatbots and AI assistants can be tricked by hidden instructions in user messages, documents or web pages into revealing data, ignoring rules or taking actions they should not.
8. Weak authentication
No email verification, weak password rules, no multi-factor authentication and no limits on login attempts make accounts easy to take over.
9. Insecure file uploads and storage
Public storage buckets, unchecked file types and missing size limits let attackers upload malware or download private files such as IDs and invoices.
10. Debug settings and leaked information
Detailed error messages, test accounts, open admin panels and forgotten debug pages give attackers a map of your system.
How attackers find vulnerable sites
Most attacks are automated. Bots scan the internet for new domains, read JavaScript files looking for keys, test common database endpoints and try leaked passwords. Public code repositories are scanned for secrets within minutes of being published. Being a small business in Nairobi, Mombasa or Kisumu does not make you invisible.
How to protect your AI-generated software
- Keep secrets on the server. Store API keys in a secure secrets manager or server environment variables, never in browser code or Git. Rotate any key that was ever exposed.
- Lock down your database. Turn on row-level security or equivalent access rules for every table and test them as a logged-out user and as a different user.
- Check permissions on the server. Every request that reads or changes data must confirm who the user is and what they are allowed to do. Store roles in a protected table, not in the browser.
- Validate every input on the server: types, lengths, formats and allowed values. Use parameterised queries and escape output.
- Use proper authentication with email verification, strong passwords, multi-factor authentication for admins and rate limits on login and sign-up.
- Scan your code and dependencies with security scanners and dependency checkers, and fix critical findings before launch.
- Keep everything updated. Patch frameworks, plugins and libraries regularly; remove what you do not use.
- Protect AI features. Treat model output as untrusted, limit what tools an AI assistant can use, and never let it access data the current user cannot see.
- Add security headers, HTTPS and a firewall such as a web application firewall or CDN protection.
- Log, monitor and back up. Keep audit logs of logins and admin actions, set alerts for unusual activity and test restoring backups.
- Get a human review. Before launch, have an experienced developer or security tester review the app, especially anything handling payments, health, school or personal data.
Quick pre-launch security checklist
- No secret keys visible in the browser or code repository
- Database access rules tested for every table
- All permission checks enforced on the server
- Input validation on every form and API
- Admin accounts protected with multi-factor authentication
- Dependencies scanned and up to date
- Backups working and restore tested
- Privacy notice and data protection measures in place
Your legal duty in Kenya
The Data Protection Act, 2019 requires anyone collecting personal data to protect it with appropriate technical and organisational measures, and some breaches must be reported to the Office of the Data Protection Commissioner. The Computer Misuse and Cybercrimes Act, 2018 also covers unauthorised access and data interference. Using an AI tool to build your system does not reduce these responsibilities.
Conclusion
AI is a powerful way to build software faster, but security still needs deliberate attention. Keep secrets on the server, lock down your data, check permissions on every request and get a professional review before launch. Permalink Business Ltd builds and reviews websites and custom software with security built in. Read more in our guide on protecting your computers from cyber attacks.
Permalink Business Ltd. helps Kenyan businesses with websites, software, branding, networking and security. Request a free quote today.
Frequently asked questions
Are websites built with AI tools less secure?
Not automatically, but they are often launched without a security review. The code may work perfectly while still exposing data, keys or admin features that an experienced developer would lock down.
What is the biggest risk in an AI-generated app?
Exposed data. Missing access rules on the database, or secret API keys placed in browser code, can let anyone read or change customer records.
Can I just ask the AI to make my app secure?
It helps, but it is not enough. AI tools can miss issues or claim a fix that does not work, so use automated security scans and a human review before going live.
What should I do if my AI-built site is hacked?
Take it offline or into maintenance mode, rotate every password and API key, restore from a clean backup, fix the root cause and, if personal data was exposed, assess whether you must notify the Office of the Data Protection Commissioner.
Does the Data Protection Act apply to small websites?
Yes. If your site collects names, phone numbers, emails or payments from people in Kenya, the Data Protection Act, 2019 requires you to protect that data with appropriate security measures.



