Penetration Testing (Pentest)

Gemini CLI on Kali Linux: Pentest Automation and Risks

OraSecOctober 8, 20254 min read

Written by the OraSec security research team — offensive security engineers and penetration testers.

gemini-cli-kali-linux

<span style="white-space: pre-wrap;">Gemini CLI on Kali Linux takes a plain-language prompt and plans the commands itself, which is what makes the approval mode worth setting deliberately.</span>

Kali now packages an AI agent that can execute shell commands and modify files with the permissions available to the user running it. By default, potentially mutating actions require approval. Gemini CLI exposes shell and filesystem tools, but it does not automatically have privileges beyond the account running it. (Gemini CLI)

What Is Gemini CLI?

Gemini CLI is Google's open-source AI agent for the terminal. Kali includes gemini-cli in its repositories, so it can be installed through APT. Kali's repository contained version 0.51.0 in July/August 2026, shown as gemini-cli_0.51.0-0kali1, dated July 23, 2026. Gemini CLI itself is built on Node.js.

You describe what you want in plain language. The agent plans the steps and uses its tools:

  • Shell tool, which can execute commands available in the local environment, subject to the current user's permissions, Gemini CLI policies, approval mode, and any configured sandbox. (GitHub)
  • File system tools, which read, write, and modify local files
  • Web fetch and search, for pulling in external references
  • Context and session features, which let Gemini CLI retain or reload relevant instructions and conversation state. GEMINI.md files can also provide persistent project context.

Typing /tools lists what is available.

How Does It Work in a Pentest?

Instead of chaining commands by hand, you state the outcome: scan the target, enumerate services, then check the login form for injection. The agent decides the sequence, runs it, and adjusts.

Two approval modes decide how much rope it gets. Default approval mode prompts before sensitive tool actions such as shell execution and file modification. Read-only operations may not require the same confirmation. (Gemini CLI)

YOLO mode automatically approves tool calls. Gemini CLI also enables sandboxing by default when YOLO mode is used, although sandbox behavior can be configured or overridden. (GitHub)

Why Does It Matter?

Reconnaissance and enumeration consume time without demanding much judgement. That is where automation pays.

None of that is the interesting part for a security team.

What Are the Risks?

Client data leaves your machine. Information included in model requests can leave the local machine, including prompts and file contents deliberately added to context. Tool results may also become model context. The exact data handling, retention, and use depend on whether Gemini CLI is authenticated through an unpaid Gemini service, a paid Gemini API project, or Vertex AI. (GitHub)

Files deliberately included in context can be sent to the model, so sensitive files should be excluded. Gemini CLI supports .geminiignore specifically to prevent selected files such as .env files or database dumps from being read into context. (GitHub)

Prompt injection through tool output. Indirect prompt injection is a relevant risk when an agent processes untrusted repository, web, or tool content. Malicious instructions embedded in that content may attempt to influence subsequent agent actions, making approval and isolation controls important. Gemini CLI's own project has tracked this risk for repository content. (GitHub)

Autonomous execution and scope. YOLO mode removes the normal approval step before tool execution, so commands may run without individual human review. An agent that scans an adjacent host has left your authorised scope, and it cannot verify authorisation because it has never seen your scope document.

Confident wrong answers. A suggested vulnerability is a hypothesis. Without proof, it does not belong in a report.

Dependency surface. It is a Node.js package with a dependency tree, on the machine that holds your tooling and client data.

Common Mistakes

  • Running YOLO mode outside a lab. Convenience during research can become an unreviewed action against production.
  • Letting it replace methodology. A faster path through the wrong process is still wrong.

How to Reduce the Risk

What Should Security Testing Cover?

If your organisation runs AI agents with tool access, ask your testers to establish:

How OraSec Can Help

OraSec provides AI and LLM security testing for organisations deploying agents with tool access. We test what the agent can be made to do, not what the documentation says it does.

Conclusion

Gemini CLI is a genuine time-saver for the repetitive parts of an assessment.

It is also an agent with shell access, reading untrusted input, and sending your working data to someone else's API. The useful position is to use it deliberately, with approval prompts on and a clear answer to what leaves your machine.

FAQs

How do I install Gemini CLI on Kali? sudo apt install gemini-cli. It requires Node.js, which apt resolves as a dependency.

Does it replace a penetration tester? No. It can accelerate repetitive analysis, command execution, code review, and documentation, but scope decisions, risk judgement, exploitation safety, and validation remain the tester's responsibility.

Explore related services

Need hands-on help? Our security testing services put this research into practice.

certificate-based-authentication
Security

Certificate-Based Authentication (CBA): A Simple Guide

Passwords are easy to use and easy to steal. Certificate-based authentication replaces the thing a user types with a key they never see. It is one of the strongest authentication methods available. It is also one of the easiest to deploy badly. What Is Certificate-Based Authentication? CBA proves identity with a digital certificate instead of a password. Three parts do the work. * The X.509 certificate carries the identity information and the public key * The private key is used to prove

·3 min read
host-based-intrusion-detection
Security

What Is a Host-Based Intrusion Detection System (HIDS)?

Network monitoring watches traffic crossing the wire. It does not see a process reading a file it should never open. That gap is what a host-based intrusion detection system fills. What Is a HIDS? A HIDS monitors activity on an individual computer or server rather than the network. Most install an agent on each host. Some environments use agentless log collection or syslog where an agent cannot be installed. This can provide useful visibility, but generally offers less host telemetry than a

·3 min read
ghidra-nsa-reverse-engineering-tool
Security

Ghidra: NSA's Free Reverse Engineering Tool Explained

The NSA gives away its reverse engineering framework. Seven years on, it remains one of the most widely used free reverse engineering tools. What Is Ghidra? Ghidra is the NSA's open-source software reverse engineering (SRE) framework, released publicly in 2019. It disassembles and decompiles compiled binaries, so an analyst can read what a program does without having the source code. It runs on Windows, macOS, and Linux, supports a wide range of processor architectures and executable formats

·4 min read