Skip to content

On Windows, some tool-generated PowerShell commands can be blocked by Defender as Trojan:Win32/ClickFix.SA!A #15423

Closed as not planned

Description

@Gyropilot2

Summary

On Windows, a tool-generated PowerShell command used during normal repo work was blocked by Microsoft Defender as:

Trojan:Win32/ClickFix.SA!A

This appears to be a false positive, but it can break the agent/tool workflow in a confusing way because the command simply fails and the user may not realize Defender intervened.

What happened

During a debugging/editing session, Defender blocked a PowerShell command line that looked roughly like this:

  • powershell.exe -Command ...
  • included inline console encoding setup such as:
    • [Console]::OutputEncoding=[System.Text.Encoding]::UTF8;
  • then ran an rg search command
  • the search argument itself contained mojibaked / garbled Unicode text

The Defender notification described the program as dangerous because it “executes commands from an attacker.”

Why this seems relevant to the tool

The command was not malicious user malware behavior. It was part of normal agent/tool-assisted repository work.

My guess is that the generated command line accidentally matched a Defender heuristic because it combined:

  • powershell.exe -Command
  • inline environment/encoding manipulation
  • a strange-looking quoted argument containing corrupted Unicode / mojibake

That combination can look a lot like obfuscated or suspicious PowerShell activity even when the intent is harmless.

Impact

This can cause tool actions to fail in a way that is hard to diagnose:

  • the command may silently fail from the user’s perspective
  • the agent may behave as if a search/edit tool is unreliable
  • the real reason is that Defender blocked the command line

In my case, this was likely entangled with a separate UTF-8 / mojibake issue, which made the command arguments look even stranger.

Environment

  • Windows
  • PowerShell 5.1
  • Microsoft Defender enabled
  • Repo work involving Markdown files and search/edit commands

Suggestion

It would help if Windows-targeted tool execution avoided command shapes that are more likely to trip Defender heuristics, especially:

  • inline powershell.exe -Command wrappers when not necessary
  • inline encoding mutations if they can be handled more safely elsewhere
  • passing visibly corrupted Unicode strings as command arguments

If possible, safer options might include:

  • relying on a UTF-8-configured shell session instead of prepending encoding tweaks per command
  • invoking tools more directly instead of wrapping everything in inline PowerShell
  • sanitizing or avoiding mojibaked search strings before command construction

Additional context

This seems related to another issue where UTF-8 Markdown content could appear as mojibake in the tool context on Windows. If the tool is already constructing commands from corrupted text, that may increase the chance of Defender false positives.

Activity

  1. added
    bugSomething isn't working
    CLIIssues related to the Codex CLI
    windows-osIssues related to Codex on Windows systems
    tool-callsIssues related to tool calling
    on Mar 21, 2026
  2. github-actions commented on Mar 21, 2026

    @github-actions
    Contributor

    Potential duplicates detected. Please review them and close your issue if it is a duplicate.

    Powered by Codex Action

  3. etraut-openai commented on Mar 21, 2026

    @etraut-openai
    Contributor

    This doesn't sound like a Codex issue. Codex is simply executing tools. If Defender blocks them, then you'll need to figure out how to configure Defender.

  4. Gyropilot2 commented on Mar 21, 2026

    @Gyropilot2
    Author

    Fair.
    In this case the problem was most likely aggravated by a related problem: #15422
    The AI had to get really creative with tools and Windows found that suspicious
    Solving that problem and allowing the threat on Windows was my solution
    Thanks for reviewing my issue ticket though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIbugSomething isn't workingtool-callsIssues related to tool callingwindows-osIssues related to Codex on Windows systems

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions