Security is not a feature. It's what's left when everything else fails.
At Nebula, security is part of every project from day one. Not because we're paranoid, but because real attacks don't wait for someone to have time to "think about security later."
Laravel has solid defense mechanisms. But they're not automatic: you need to know them, activate them and use them correctly. Here we explain the most common vulnerabilities we find in real audits and how to fix them.
The most frequent vulnerabilities in Laravel applications
1. SQL Injection
Laravel has an ORM (Eloquent) and a query builder that escape parameters automatically. The problem appears when someone uses raw SQL queries with user variables interpolated directly.
The typical scenario: a developer needs a query they can't easily write with the ORM and writes raw SQL by concatenating request variables directly into the string. That's the direct path to a SQL injection attack.
The solution: if you need raw queries, Laravel allows using binding parameters - placeholders that the framework escapes automatically. You should never concatenate user variables in SQL directly.
Laravel's ORM exists precisely to prevent this problem. If you're avoiding it, ask yourself why.
2. Cross-Site Scripting (XSS)
Blade, Laravel's templating engine, escapes variables automatically when you use the standard syntax. The problem is when the "HTML without escaping" syntax is used to display dynamic content that comes from the user.
The rule with no exceptions: never render user-generated HTML without sanitizing it first. Laravel has helpers for this. If you need to display user HTML for some legitimate reason, sanitize with a dedicated library before rendering.
3. Mass Assignment
Eloquent allows creating or updating records by passing request data directly. If you don't explicitly define which fields are mass-assignable (the model's fillable property), an attacker can include additional fields in the request - like role, is_admin or balance - and modify them.
All models must have explicitly defined which fields can be modified from the outside. No exceptions, no model with an empty list that "gets filled in later."
4. Weak Authentication
The most common problems we find in audits:
Laravel Sanctum and Passport provide secure authentication, but they need to be configured correctly. Default values aren't always sufficient for production applications.
5. Sensitive Information Exposure
Configuration errors that expose information that shouldn't be public:
What we do in every project
Entry point review
Before any changes, we map all system entry points: forms, API endpoints, URL parameters, file uploads, third-party integrations. Each one is a potential attack surface.
HTTPS and security headers
Everything on HTTPS, no exceptions. We also configure the HTTP headers that many applications ignore: Content-Security-Policy, X-Frame-Options, X-Content-Type-Options, Strict-Transport-Security. These headers prevent entire categories of attacks with a single line of configuration.
Validation at all system boundaries
All user input is validated with Laravel's Form Requests before processing. Uploaded files are validated by real MIME type (not just extension), maximum size, and stored outside the public directory. Data that will be displayed in HTML is sanitized.
Rate limiting on sensitive endpoints
Login, registration, password reset and any public API have rate limiting configured. It doesn't eliminate sophisticated attacks, but it eliminates 90% of the automated noise that hits any system in production.
Monitoring and alerts
Security events are logged: repeated failed login attempts, access from unusual IPs, critical errors. If you don't know someone is probing your system, you can't defend yourself.
When does a security audit make sense?
Security without excuses
The vulnerabilities we've described are not theoretical. These are the ones we find in real applications of real companies. And most of them have a direct fix if identified in time.
If you have a Laravel system in production and aren't certain it's well protected, it's time to find out.
We perform security audits with a concrete report: what's wrong, what risk it represents and how to fix it. Without unnecessary alarmism, without selling solutions that aren't needed.
Share

Written by
Santiago Bugnón
CTO @ Nebula Solutions



