Skip to main content

Insecure Access Control

Fixing Insecure Access Control

About Insecure Access Control

What is improper access control?

Improper access control is a vulnerability that occurs when a system does not properly restrict or enforce access to resources, such as files, directories, network resources, or application functions.

Examples of improper access control vulnerabilities include:

  • Weak access controls: When access controls are weak or easily bypassed, attackers can gain access to sensitive resources or data by exploiting security weaknesses.
  • Insufficient authorization checks: When authorization checks are insufficient, it can allow unauthorized users to access sensitive data or resources, or to perform actions that they are not authorized to do.
  • Overly permissive access: When access controls are overly permissive, they can allow users to access resources or data that they do not need, increasing the risk of data breaches or other security incidents.

Check out these videos for a high-level explanation:

  • Missing function level access control

  • Missing object level access control

What is the impact of improper access control?

Improper access control can lead to various security threats, such as:

  • Data breaches: Improper access control can allow attackers to access sensitive data, leading to data breaches, data loss, or unauthorized access to confidential information.
  • Unauthorized access to resources: Attackers can exploit improper access control to gain unauthorized access to resources, such as servers, databases, and applications.
  • Account takeover: Attackers can use improper access control to take over user accounts and gain access to sensitive data or resources.

How to prevent improper access control?

Here are some measures that can help ensure proper access control:

  • Strong access controls: Implement strong access controls that restrict access to sensitive resources or data based on user roles and permissions.
  • Proper user authentication and authorization: Implement proper user authentication and authorization mechanisms to ensure that only authorized users can access sensitive data and resources.
  • Input validation and sanitization: Validate and sanitize user input before using it to access internal objects or data. Use regular expressions or input filters to remove or encode any special characters that could be used to access sensitive data or resources.
  • Least privilege: Use the principle of least privilege to restrict access to resources to only what is necessary for each user role. This can help prevent attackers from gaining access to resources that they do not need to access.
  • Regular security audits: Regularly audit your system for security vulnerabilities, including improper access control vulnerabilities. Use automated tools and manual testing to identify potential issues and fix them before they can be exploited.

References

Taxonomies

Explanation & Prevention

Training

RDP Access Is Not Restricted

Check if the Google compute firewall allows unrestricted RDP access. Allowed ports should not contain RDP port 3389.

Rule-specific references:

Option A: Make sure the default RDP port is not open

properties should not have an ingress rule with:

  • Unrestricted sourceRanges (by being specific or not having a sourceRanges defined)
  • and with allowed array containing an object with IPProtocol of tcp or udp combined with ports array containing 3389
  1. Locate one of the following vulnerable patterns:

    Vulnerable pattern:

    resources:
    - name: firewall
    type: compute.v1.firewall
    properties:
    name: my-firewall
    sourceRanges:
    - "0.0.0.0/0"
    allowed:
    - IPProtocol: icmp
    ports:
    - "80"
    - "8080"
    - "1000-2000"
    - IPProtocol: tcp
    ports:
    - "80"
    - "8080"
    - "1000-2000"
    - "3389"

    Vulnerable pattern:

    resources:
    - name: firewall
    type: compute.v1.firewall
    properties:
    name: my-firewall
    sourceRanges:
    - "::/0"
    allowed:
    - IPProtocol: icmp
    ports:
    - "80"
    - "8080"
    - "1000-2000"
    - IPProtocol: udp
    ports:
    - "80"
    - "8080"
    - "1000-2000"
    - "21-3389"
  2. Modify the config to something like the following:

    Replacement pattern:

    resources:
    - name: firewall
    type: compute.v1.firewall
    properties:
    name: my-firewall
    allowed:
    - IPProtocol: icmp
    ports:
    - "80"
    - "8080"
    - "1000-2000"
  3. Test it

  4. Ship it 🚢 and relax 🌴

SSH Access Is Not Restricted

Check if Google Firewall allows SSH access (port 22) from the Internet (public CIDR block).

Rule-specific references:

Option A: Make sure the default SSH port is not open

properties should not have an ingress rule with:

  • Unrestricted sourceRanges (by being specific or not having a sourceRanges defined)
  • and with allowed array containing an object with ports array containing 22
  1. Locate one of the following vulnerable patterns:

    Vulnerable pattern:

    resources:
    - name: firewall
    type: compute.v1.firewall
    properties:
    name: my-firewall
    sourceRanges:
    - "0.0.0.0/0"
    allowed:
    - IPProtocol: icmp
    ports:
    - "80"
    - "8080"
    - "1000-2000"
    - "22"

    Vulnerable pattern:

    resources:
    - name: firewall
    type: compute.v1.firewall
    properties:
    name: my-firewall
    sourceRanges:
    - "0.0.0.0/0"
    allowed:
    - IPProtocol: icmp
    ports:
    - "80"
    - "8080"
    - "1000-2000"
    - "21-3390"
  2. Modify the config to something like the following:

    Replacement pattern:

    resources:
    - name: firewall
    type: compute.v1.firewall
    properties:
    name: my-firewall
    allowed:
    - IPProtocol: icmp
    ports:
    - "80"
    - "8080"
    - "1000-2000"
  3. Test it

  4. Ship it 🚢 and relax 🌴