Looking for the vulnerability index of Invicti's legacy products?
Unauthenticated Access to Sensitive Functions - Vulnerability Database

Unauthenticated Access to Sensitive Functions

Description

This vulnerability occurs when an application exposes sensitive functions, endpoints, or resources without requiring authentication. Attackers can directly access these protected operations by sending crafted requests, completely bypassing security controls. This represents a fundamental security failure where critical functionality is accessible to anyone who knows or discovers the endpoint URL or function name.

Remediation

Implement comprehensive authentication and authorization controls for all sensitive functions:

1. Enforce Authentication on All Sensitive Endpoints
Identify all endpoints that access or modify sensitive data and ensure they require valid authentication. Never rely on obscurity or assume endpoints are unknown to attackers.

2. Implement Robust Authentication Mechanisms
Use industry-standard authentication protocols such as OAuth 2.0, OpenID Connect, or JWT (JSON Web Tokens). Example middleware implementation:

// Express.js authentication middleware example
const authenticateUser = (req, res, next) => {
  const token = req.headers.authorization?.split(' ')[1];
  
  if (!token) {
    return res.status(401).json({ error: 'Authentication required' });
  }
  
  try {
    const decoded = jwt.verify(token, process.env.JWT_SECRET);
    req.user = decoded;
    next();
  } catch (error) {
    return res.status(401).json({ error: 'Invalid or expired token' });
  }
};

// Apply to sensitive routes
app.post('/api/admin/users', authenticateUser, adminController.createUser);
app.delete('/api/data/sensitive', authenticateUser, dataController.delete);

3. Implement Authorization Checks
Authentication alone is insufficient. Verify that authenticated users have permission to perform the requested action using role-based access control (RBAC) or attribute-based access control (ABAC):
// Authorization middleware example
const requireRole = (allowedRoles) => {
  return (req, res, next) => {
    if (!req.user || !allowedRoles.includes(req.user.role)) {
      return res.status(403).json({ error: 'Insufficient permissions' });
    }
    next();
  };
};

// Apply role-based authorization
app.post('/api/admin/settings', 
  authenticateUser, 
  requireRole(['admin', 'superadmin']), 
  settingsController.update
);

4. Apply Defense in Depth
- Use centralized authentication/authorization logic to ensure consistent enforcement across the application
- Implement secure session management with appropriate timeouts and token rotation
- Apply the principle of least privilege, granting only minimum necessary permissions
- Use framework-level security features (e.g., Spring Security, Django authentication) rather than custom implementations

5. Validate and Monitor
- Conduct regular security audits and penetration testing to identify unprotected endpoints
- Implement comprehensive logging for all authentication and authorization events
- Monitor for suspicious patterns such as repeated failed authentication attempts or access to sensitive functions
- Use automated security scanning tools to detect missing authentication controls during development