Supercharge Your Security Visibility with Chrome Enterprise and Google SecOps - Part 3

alikapucu
Staff

alikapucu_1-1715704620233.pngIn previous blogs, Supercharge Your Security Visibility with Chrome Enterprise and Google SecOps - Part 1 and Part 2 we explored how integrating Chrome Enterprise with Google SecOps can significantly enhance your security posture. We showed how Chrome event data provides valuable insights for analysis, incident response, and threat detection. But we're not done yet! Today, we are embarking on a new adventure to handle third-party API integrations in Google SecOps playbooks so we can further strengthen our security defenses. By leveraging these APIs, we can enrich Chrome Enterprise events, providing even deeper visibility into your environment and helping in critical decision-making.

Now, let's talk about Chrome extensions. We all love them, right? They make our lives easier, add fun features to our browsers, and generally just make things better. But here's the thing: extensions aren't always what they seem. Sometimes, they're up to no good.

Let's look at some real-world examples so you can see what I'm talking about:

SearchBlox: This extension pretended to be a helpful tool for Roblox players, but it actually stole their accounts and stuff they earned in the game. 
Fake ChatGPT Extensions: Extension promised to make ChatGPT better. But these were just traps designed to steal Facebook login info and take over accounts.
ChromeLoader: This piece of malware hid in pirated downloads, then bombarded users with annoying ads and messed with their search results to send them to sketchy websites.
Kimsuky Spy Extension: This one was like a secret agent, reading Gmail messages without anyone knowing – even if you had two-factor authentication turned on.
Rilide: Targeting cryptocurrency users, stealing their passwords and even redirecting their money to the attacker's own wallet.

In this post, I will take the first steps through the process of integrating two powerful tools, CRXcavator and Spin.AI, into the Google Security Operations platform. These tools offer invaluable risk assessments for browser extensions, providing critical insights into potential vulnerabilities. Although there are no official integrations for either platform, We will develop our own custom integrations. This approach will enable us to utilize their APIs effectively and seamlessly retrieve risk scores for installed extensions.

Creating Rule to Detect Browser Installation Events

First of all, we need to capture Chrome extension installation events from the Chrome Enterprise we set up in our previous blog post. To do that, we'll create a simple rule:

 

rule chrome_management_browser_extension_install_event {
  meta:
    author = "GCP Security"
    description = "Chrome Management browserExtensionInstallEvent event"
    type = "Alert"
    data_source = "Chrome Enterprise"
    platform = "GCP"
    severity = "Low"
    priority = "Low"
  events:
    $e.metadata.product_name = "Chrome Management"
    $e.metadata.product_event_type = "browserExtensionInstallEvent"
  outcome:
    $event_type = $e.metadata.event_type
    $log_type = $e.metadata.log_type
    $user = $e.principal.user.email_addresses[0]
    $hostname = $e.principal.hostname
    $extension_id = $e.target.resource.product_object_id
    $extension_name = $e.target.resource.name
  condition:
    $e
}

 

This rule focuses on Chrome Management logs, specifically looking for events where metadata.product_event_type = "browserExtensionInstallEvent" When it spots one, it grabs key details like the user, hostname, extension id, and extension name. We'll use this information later in our playbook.

Once we enable this rule, we'll get an alert every time a new Chrome extension is installed on one of our managed browsers.

Setting Up Integrations for Browser Extension Check

As I mentioned, above there are not readily available integrations for CRXcavator or Spin.AI in the Google SecOps marketplace, however, we have the power to build our own custom integration. This allows us to directly leverage their APIs and seamlessly incorporate their risk assessment capabilities into our security playbooks. To achieve this, we will use the IDE (Integrated Development Environment) within Google SecOps. 

Step 1: Creating a New Integration

  1. Navigate to the IDE within Response / IDE and click the plus (+) sign in the upper right corner.
  2. Choose 'Integration' and input 'Browser Extension-Check' into the Integration Name field.

alikapucu_3-1715102654331.png

Step 2: Configuring the Integration

  1. Click on the Gear Icon alikapucu_0-1715102970720.png next to the Browser-Extension-Check integration. This opens a dialog box for configuring the integration. Here are the available options:

alikapucu_1-1715103044312.png

  • Running on Python: This option allows you to select the Python compiler that the integration will run on.
  • Description: A brief summary of what the integration does.
  • SVG Icon and Image: These are visuals that appear in the playbook when this integration is executed.
  • Categories: This defines the grouping under which the integration will be classified.
  • Libraries: This feature enables the importing of third-party Python libraries into your integration. The platform performs a 'pip install' on these libraries, making them accessible within actions, jobs, and connectors. For example, in our integration, I added the 'requests' library to facilitate HTTP GET requests.
  • Script Dependencies: This option allows for the incorporation of additional third-party libraries from your local system into the integration.
  • Parameters: This setting allows you to configure both required and optional parameters for the integration, typically including API endpoints and credentials.

    alikapucu_3-1715103157097.png

Step 3: Configuring the Integration for Testing

  1. Click the Gear alikapucu_0-1715102970720.png icon at the top right of the screen and navigate to 'Integrations'.
  2. Under 'Shared Instances', click the '+' sign in the upper right, locate the 'Browser-Extension-Check' integration in the 'Add Instance' dialog box. Select it by clicking the checkbox and then click 'Save'.

alikapucu_0-1715103333066.png

Currently, the "Test" button isn't functional. So, to check our integration, we'll need to create a "Ping" action to see if our API endpoints are reachable. We'll do this by making direct calls to both the CRXCavator and Spin.AI endpoints and verify that we get the expected responses. This simple test will confirm that our integration is working as intended.

Step 4: Crafting the Action

  1. Return to the IDE and click the Plus (+) sign in the upper left corner. Fill in the following fields:
    • Action Name: Ping
    • Integration: Browser-Extension-Check
    • Action Type: Sync

Use the code below:

 

from SiemplifyAction import SiemplifyAction
from SiemplifyUtils import output_handler
from ScriptResult import EXECUTION_STATE_COMPLETED, EXECUTION_STATE_FAILED

import requests
import json

INTEGRATION_NAME = "Browser-Extension-Check"
SCRIPT_NAME = "Ping"

@output_handler
def main():
    siemplify = SiemplifyAction()
    siemplify.script_name = SCRIPT_NAME  # Updated to use a consistent naming convention

    # Hard-coded extension ID
    extension_id = "aapbdbdomjkkjkaonfhkkikfgjllcleb"

    # Spin API URL 
    spin_url = f"https://apg-1.spin.ai/api/v1/assessment/platform/chrome/{extension_id}"
    crxcavator_url = f"https://api.crxcavator.io/v1/report/{extension_id}"

    # Function to perform API requests
    def check_api(url):
        try:
            response = requests.get(url)
            if response.status_code == 200:
                data = response.json()
                return True, data
            else:
                return False, f"Failed to connect, status code: {response.status_code}"
        except requests.RequestException as e:
            return False, f"HTTP request failed: {str(e)}"

    # Check Spin API
    spin_success, spin_result = check_api(spin_url)
    if spin_success:
	# Log response from Spin.
        siemplify.result.add_result_json(json.dumps(spin_result))  

    # Check Crxcavator API.
    crx_success, crx_result = check_api(crxcavator_url)

    if crx_success:
	# Log response from Crxcavator
        siemplify.result.add_result_json(json.dumps(crx_result))  
        
    # Finalize results
    if spin_success and crx_success:
        siemplify.end("Both API checks succeeded", True)
    else:
        failed_message = "API Check Failed: " + "; ".join([spin_result, crx_result])
        siemplify.end(failed_message, False)

if __name__ == "__main__":
    main()

 

Let's break down this action code, which we will use to test our integration. Think of it like sending a quick "Hello!" to see if they're listening.

1. Setting the Stage:
  • Lines 1-5: Import Statements: We bring in necessary tools from Siemplify libraries to interact with the SecOps platform and the requests library to make HTTP calls to the APIs. Additionally, the json library is imported to work with JSON formatted data.
  • Lines 8-9: Constants: Defining the names of our integration and script for logging and identification purposes.
2. Main Action Logic:
  • Line 13: Siemplify Action Instance: We create a SiemplifyAction object named siemplify. This acts as our primary interface to interact with the SOAR platform, allowing us to log information, return results, and signal success or failure of the action.
  • Line 14: Setting Script Name: To ensure consistent naming conventions, we explicitly set the script_name attribute of the siemplify object to the constant SCRIPT_NAME defined earlier.
  • Line 17: Extension ID (Hardcoded for Now): We temporarily hardcode the ID of the Google Translate extension. In a real-world scenario, this ID would be dynamically retrieved from the security event that triggered the playbook.
  • Lines 20-21: API URLs: We build the URLs for the Spin.AI and CRXCavator APIs. These APIs provide information and assessments about browser extensions. We insert the extension_id into the URLs so that the API knows which extension to analyze.
3. API Checker Function:

We define a reusable function check_api that takes a URL as input and performs an HTTP GET request. It then checks the response status code:

  • Lines 24-33: check_api Function: We define a reusable function that takes a URL as input and performs an HTTP GET request. It then checks the response status code.
  • Lines 25-29: API Request and Success: It uses the requests library to send a GET request to the provided URL. If the response status code is 200 (success), it parses the JSON data from the response and returns True along with the data.
  • Lines 30-33: Error Handling: If the request fails (non-200 status code or a network error), it returns False along with an error message explaining the issue.
4. Testing Both APIs:
  • Lines 36-46: We call the check_api function for each API URL, storing the outcome (success or failure) and any data/error messages.
    If successful, the response data from each API is logged to the Siemplify result section for further analysis. We also log the raw JSON response using the add_result_json method from Siemplify object, making detailed information available within the SecOps platform for analysis or future actions (as we'll leverage in our next action development).
5. Finalizing the Action:
  • Lines 48-50: Result Determination: We check if both API calls were successful. If so, we call the end method from the siemplify object to signal that the action completed successfully. We also provide a message confirming success.
  • Lines 51-53: Any Failure: The action ends with a failure status and a message summarizing the errors encountered.

By successfully executing this "Ping" action, we can confirm that our integration with the Spin.AI and CRXcavator APIs is working as expected.

alikapucu_1-1715103469657.png

In this blog, we focussed on creating the initial custom integration with Google SecOps and built our first test action. In our next blog, we'll take the foundation we've built today and expand upon it. We'll create another action script that pulls risk scores for browser extension. We'll then integrate this script into our playbook, allowing us to automatically assess the risk of newly installed extensions and take appropriate action.