Back-end11 min read
Unauthorized pentest on your SaaS: what to do
Fake accounts and scans on your SaaS? Step by step: find out what happened, keep the evidence, contain, notify CERT.br, file a police report and check the LGPD.

This week a screenshot went around on X that everyone running a SaaS in production has seen or will see one day: a list of freshly registered "companies", with names that looked alike, all of them with their tax registration still pending. They were not customers. Someone was testing the system on their own. The post asked a direct question: where do I report this unauthorized pentest?
The replies were spot on: a police report (in Brazil, a boletim de ocorrência, or BO), a notification to CERT.br and, above all, keeping the evidence. This post puts all of that in order, with what you can do in the code and in the logs at each step.
An honest warning: I'm not a lawyer. The post is about Brazilian law, and the laws it mentions are linked to their official text at the end. Deciding to take someone to court is your call, with legal advice. What I bring here is the engineering side: what to look at, what to keep and what to fix.
TL;DR#
- An unauthorized pentest is just an attack. A real penetration test has written authorization and a scope. Without that, the intent of whoever did it does not change what happened.
- First, find out what happened. A fake account created through the public signup is one thing. Access to another customer's data is something else, and much more serious.
- Keep the evidence before cleaning up. Export the logs, hash the files and write down the timeline. Suspend the accounts instead of deleting them.
- Contain: signup limit per IP, temporary blocking, rotating secrets if anything leaked and fixing whatever was found.
- Notify: the abuse contact of the network the attack came from, with
cert@cert.brin copy, and file the police report. - If customers' personal data was exposed with relevant risk, the LGPD applies: notify the ANPD and the data subjects within 3 business days.
- Publish a
security.txt, so people who find a flaw in good faith have a way to reach you.
A pentest has a contract, an attack doesn't#
A pentest (penetration test) is a service: the company hires it, signs a document stating what can be tested, when and how, and gets a report at the end. That authorization is what separates security work from a crime.
Without it, calling it a "pentest" is just a friendlier name. It could be a student practicing on the wrong system, a bounty hunter hoping to sell the finding, or someone looking for a hole to actually use. On your side, the response is the same: treat it as a security incident.
1. Find out what actually happened#
Before reporting anything, you need to know how big the problem is. These are very different scenarios:
- Mass signups through the public form. Annoying, it pollutes the database and it may be the start of something bigger, but on its own it is not access to anyone's data.
- Scanning: thousands of requests to routes that don't exist, injection attempts, automated tools looking for forgotten files such as
.envor.git. - Unauthorized access: one account reading or changing another company's data, for example by swapping the
org_idin the URL (the well-known IDOR, when the server doesn't check whether the resource belongs to whoever asked for it).
Start with the database. Accounts created in a row, from the same IP, are the first sign:
-- Accounts created in the last 7 days, grouped by signup IP.
select signup_ip,
count(*) as accounts,
min(created_at) as first_seen,
max(created_at) as last_seen,
array_agg(name order by created_at) as names
from organizations
where created_at > now() - interval '7 days'
group by signup_ip
having count(*) >= 3
order by accounts desc;If you don't store the signup IP, now is the time to start. Then move on to the access logs. Scanning tools usually identify themselves in the User-Agent and leave a trail of 404 and 403 responses:
# Requests whose User-Agent belongs to common scanning tools.
grep -iE 'sqlmap|nuclei|ffuf|gobuster|nikto|dirsearch|wpscan' access.log | head
# IPs with the most 401/403/404 responses: probing leaves a trail of errors.
awk '$9 ~ /^(401|403|404)$/ { print $1 }' access.log | sort | uniq -c | sort -rn | headThe awk command above assumes Nginx's default log format, where the IP is the first column and the HTTP status is the ninth. Adjust it to the format of your server or platform.
The most important question comes next: did any of these accounts manage to see what it shouldn't? Look in the application logs for 200 responses to resources belonging to another organization. If your system records who accessed what, filter by the suspicious accounts and check every sensitive route.
2. Keep the evidence before cleaning up#
The instinct is to delete the fake accounts and block everything. Hold on a moment. If you delete before copying, the evidence goes with it.
- Export the logs for the period (application, web server, database, cloud provider) off the server.
- Hash every exported file. That way you can show later that nobody touched the content.
- Write down the timeline in UTC: when it started, what was done, when you noticed, what you did.
- Suspend the accounts instead of deleting them. The row stays in the database, with its creation date and IP.
mkdir -p evidence-2026-11-23
cp /var/log/nginx/access.log* evidence-2026-11-23/
psql "$DATABASE_URL" -c "\copy (select * from organizations where signup_ip = '203.0.113.7') to 'evidence-2026-11-23/orgs.csv' csv header"
# One hash per file: proof the evidence was not changed afterwards.
cd evidence-2026-11-23 && sha256sum * > SHA256SUMSTo give the evidence more weight in court, in Brazil you can record pages and screens in an ata notarial, made at a notary's office: the notary describes what they saw and it becomes a document with public faith. It's worth asking your lawyer whether it pays off in your case.
Also remember that Brazil's Marco Civil da Internet (the Internet Civil Framework, Law 12.965/2014, art. 15) requires anyone offering an internet application as a business to keep access records for 6 months, confidentially and in a secure environment. If you don't keep them yet, this incident is a good reminder.
3. Contain#
With the evidence saved, it's time to close the door.
- Suspend the accounts and end their sessions.
- Block the IPs at the edge firewall or in the WAF, temporarily. Attackers change IPs, so this buys time, it doesn't solve anything.
- Limit signups. A public form with no limit is an invitation to mass creation:
// Fixed window per IP: at most 3 signups per hour.
// In-memory for one instance; with several instances, move the counter to Redis.
const WINDOW_MS = 60 * 60 * 1000
const MAX_SIGNUPS = 3
const attempts = new Map<string, { count: number; resetAt: number }>()
export function canSignUp(ip: string, now = Date.now()): boolean {
const entry = attempts.get(ip)
if (!entry || now > entry.resetAt) {
attempts.set(ip, { count: 1, resetAt: now + WINDOW_MS })
return true
}
entry.count += 1
return entry.count <= MAX_SIGNUPS
}- If there was unauthorized access, fix the flaw before anything else. For IDOR, the rule is simple: every query filters by the organization of the logged-in user, which comes from the session, never from what the client sends.
- Rotate the secrets that may have been exposed: API keys, tokens, service passwords.
4. Notify the people who need to know#
The network owner, with CERT.br in copy#
CERT.br is the incident response team for the Brazilian internet, run by NIC.br. It takes notifications by email, at cert@cert.br, and its guidance is to send the report straight to the abuse contact of the network the attack came from, with CERT.br in copy.
To find that contact, look up the IP:
whois 203.0.113.7 | grep -iE 'abuse|e-mail|email'In the email, get straight to the point: the IP, the dates and times in UTC, what was done and an excerpt of the logs. No customer personal data in the body of the message. The provider usually warns or suspends its customer, and CERT.br uses the notifications to keep track of what is happening on the Brazilian network.
The police#
The report is filed with the Polícia Civil (the state police), preferably at a station that specializes in cybercrime. Several states accept a BO online. Bring the timeline, the exported files and the hashes.
The crime that usually shows up in these cases is intrusion into a computer device, under art. 154-A of the Brazilian Penal Code (Código Penal): breaking into a device used by someone else to obtain, tamper with or destroy data without authorization, punishable by 1 to 4 years of imprisonment and a fine since Law 14.155/2021. The penalty goes up if there is economic loss, and it is higher if the intrusion obtains trade secrets or confidential information.
Two details that catch a lot of people:
- This crime requires a formal complaint from the victim (representação, art. 154-B): the police and the public prosecutor's office only move forward if the victim states that they want the case to proceed. That's why the BO alone may not be enough.
- There is a deadline for that complaint, counted from when you find out who the perpetrator is. Don't leave it for later.
If all that happened was account creation through the public form, the legal classification is less obvious. That's for the lawyer to decide, with the evidence in hand.
Who is behind the IP#
You have the IP, but not the name. The one who knows which customer was using that IP at that time is the connection provider, and it only hands that over with a court order (art. 22 of the Marco Civil). One more reason to have kept the logs with date, time and time zone.
5. Check whether the LGPD applies#
If your customers' personal data was accessed and that may cause them relevant risk or harm, Brazil's data protection law (LGPD) requires you to notify the ANPD (the national data protection authority) and the data subjects themselves. Resolution CD/ANPD No. 15/2024 gives you 3 business days, counted from when you learn that the incident affected personal data, not from the date of the attack. Small-scale processing agents get twice as long.
The notification is made through the ANPD's channel on gov.br, and you can add information later. If only fake accounts were created and nobody read customer data, there is probably nothing to report. But write down how you reached that conclusion.
6. Open a door for the good guys#
Not everyone who finds a flaw wants to harm you. A lot of people just don't know who to talk to. security.txt solves that: it's a file standardized by RFC 9116 that says where to report vulnerabilities. It lives at /.well-known/security.txt, and only two fields are required, Contact and Expires:
Contact: mailto:security@example.com
Expires: 2027-11-23T00:00:00Z
Policy: https://example.com/security
Preferred-Languages: pt, enThe RFC recommends keeping Expires less than a year in the future. Put the renewal on your calendar.
On the policy page, make the rules clear: what can be tested, that only your own account may be used, that other customers' data is off limits, that taking the service down doesn't count, and how you respond to people who follow those rules. This separates those who want to help from those who want to attack, and gives you an objective criterion when deciding what to do.
What not to do#
- Don't attack back. Breaking into the machine of whoever attacked you is also a crime, and it destroys your position as the victim.
- Don't expose the person on social media with personal data. Besides the legal risk, you tell the attacker everything you already know.
- Don't delete the logs "to clean up the mess" before exporting them.
- Don't pay for a report that comes with a threat. Asking for money to keep a flaw quiet is extortion, not security research.
Checklist#
- I understand what happened: mass signups, scanning or unauthorized access.
- Logs exported off the server, with
SHA256SUMS. - Timeline written in UTC.
- Accounts suspended, not deleted, and sessions ended.
- Flaw fixed and secrets rotated, if there was access.
- Signup limit per IP in production.
- Email to the network's abuse contact, with
cert@cert.brin copy. - BO filed and a conversation with a lawyer about the formal complaint.
- LGPD assessment in writing, with notification to the ANPD if there is relevant risk.
security.txtpublished, withExpireson the calendar.
References#
Comments
Sign in with your GitHub account to comment.
Read next


Back-end13 min
App built with AI: what to check before you ship

Back-end18 min
What is RAG? Indexing, hybrid search and a real case