PatchDay
Patching
Deployment

Patch Wednesday Day (54/100) - Blocking DeepSeek AI for Privacy Compliance

Ashwani Paliwal
February 12, 2025

With growing concerns over data privacy and potential unauthorized data sharing, organizations need to ensure that AI tools like DeepSeek AI do not pose a security risk. SecOps Solution provides a seamless way to block DeepSeek AI across all enterprise systems using its Script Execution Policy.

By implementing this policy, organizations can manage restrictions and ensure that all devices remain compliant with security standards.

Blocking Access to DeepSeek AI Using SecOps Solution

Step 1: Define the Policy

  • Policy Name: DeepSeek Access Restriction Policy
  • Description/Comments: (Optional)
    • Example: "This policy ensures that DeepSeek AI is blocked across all Windows devices to mitigate privacy risks and prevent unauthorized data sharing."

Step 2: Targeting Devices

  • Choose the Asset Groups you want to enforce this policy on.
  • By default, all Windows devices will be selected.
  • Optionally, refine your selection to specific endpoints as needed.

Step 3: Compliance Verification Script

Before applying the policy, we must check whether the target devices are already compliant. The compliance verification script will:

  • Identify if DeepSeek AI access is already restricted or not.
# Rule name to check
$ruleName = "Block-Deepseek"
try {
   # Check if rule exists
    $existingRule = Get-NetFirewallRule -DisplayName $ruleName -ErrorAction SilentlyContinue

   if ($existingRule) {
        Write-Host "Deepseek is already blocked"
        exit 1
     } else {
       Write-Host "Deepseek is accessible"
       exit 0
     }
} catch {
    Write-Error "An error occurred while checking firewall rules: $_"
    exit 1
}

Step 4: Execution Script (Enforcing the Policy)

If a device is found to be non-compliant, the following script will be executed to enforce the policy by blocking DeepSeek AI domains.

# Check for administrator privileges
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
$isAdmin = $currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)

if (-not $isAdmin) {
    Write-Error "This script requires administrator privileges. Please run as administrator."
    exit 1
}
# Rule parameters
$ruleName = "Block-Deepseek"
$mainDomain = "deepseek.com"
$commonSubdomains = @(
    $mainDomain,
    "chat.$mainDomain",
    "www.$mainDomain",
    "api.$mainDomain"
)
try {
    # Check if rule already exists
    $existingRule = Get-NetFirewallRule -DisplayName $ruleName -ErrorAction SilentlyContinue
    if ($existingRule) {
        Write-Host "Firewall rule already exists. Removing old rule..."
        Remove-NetFirewallRule -DisplayName $ruleName
     }
    # Array to store all resolved IP addresses
    $allIPs = @()
    # Resolve each domain to IP addresses
    foreach ($domain in $commonSubdomains) {
         try {
                $ips = Resolve-DnsName -Name $domain -ErrorAction Stop | 
                Where-Object {$_.Type -eq "A"} | 
                Select-Object -ExpandProperty IPAddress
           if ($ips) {
                $allIPs += $ips
           }
        } catch {
               Write-Warning "Could not resolve IP addresses for $domain"
        }
   }
   if ($allIPs.Count -eq 0) {
        Write-Error "Could not resolve any IP addresses to block"
        exit 1
     }
    # Remove any duplicate IPs
    $allIPs = $allIPs | Select-Object -Unique
    # Create outbound blocking rule
    New-NetFirewallRule -DisplayName $ruleName `
        -Direction Outbound `
        -Action Block `
        -RemoteAddress $allIPs `
        -Protocol TCP `
        -LocalPort Any `
        -RemotePort 80,443 `
        -Profile Any `
        -Description "Blocks access to deepseek.com domains and common subdomains" | Out-Null
    Write-Host "`nSuccessfully created firewall rule to block deepseek.com domains"
} catch {
    Write-Error "An error occurred: $_"
    exit 1
}

Step 5: Scheduling the Policy for Continuous Compliance

  • Set up a recurring schedule (e.g., daily) to ensure that all devices remain compliant.
  • Automate regular checks and reapply the policy if necessary.
  • Generate compliance reports to track enforcement success.

By leveraging SecOps Solution, organizations can ensure enterprise-wide enforcement of this policy without manual intervention.

Manual Steps: Blocking DeepSeek AI

For those who prefer a manual approach, the policy can still be enforced using the following steps:

  1. Open PowerShell as Administrator.
  2. Run the following command to check if DeepSeek AI is already blocked:
    Run the compliance verification script given above to check if the rule already exists.
  3. Run the Execution Script given above to create a rule to block the access to the domains to deepseek.com
  4. Verify that DeepSeek AI is now inaccessible.
  5. (Optional) Deploy this script manually across multiple machines using a group policy or remote execution tool.

Important Note:

  1. To ensure smooth enforcement and avoid unintended consequences, keep the following points in mind:
  2. Verify device compliance using the Compliance Verification Script before applying the policy.
  3. Ensure the correct targeting of devices within SecOps Solution to prevent disruptions in unintended systems.
  4. Schedule the enforcement at appropriate times to minimize user impact and maintain operational stability.
  5. Check for any dependencies or network configurations that may conflict with this restriction.
  6. Test on a few machines first before deploying the policy across all systems to validate effectiveness.

SecOps Solution is a Full-stack Patch and Vulnerability Management Platform that helps organizations identify, prioritize, and remediate security vulnerabilities and misconfigurations in seconds.

To learn more, get in touch.

Related Blogs