Welcome to Vhack

Promptfoo + Ollama AIRed Team Lab — Setup & Results (Step-by-Step)

Scope: Local LLM red teaming on Kali Linux (VMware), using Node.js (via NVM), Promptfoo CLI, and Ollama with llama2:7b-chat. This document explains what each screenshot shows, why the step matters, and what to verify before moving on.

Step 1: Update Kali packages and install prerequisites
Screenshot reference (Step 1)

What you are doing
⦁ Update package index and apply pending upgrades to keep the VM stable before installing developer tooling.
⦁ Install core prerequisites needed later (curl, ca-certificates, git, build-essential).
Commands used
sudo apt update
sudo apt -y full-upgrade
sudo apt install -y curl ca-certificates git build-essential
What to verify
⦁ No broken packages: the apt run finishes without errors (warnings are ok).
⦁ curl and git are installed: curl --version and git --version work.
Notes
⦁ If you see interactive package prompts (e.g., services restart), selecting the default safe option is usually fine for a lab VM.
⦁ Running upgrades first avoids dependency conflicts later when installing Node and CLI tooling.
Common issues & fixes
⦁ Issue: Repository signature / NO_PUBKEY errors during apt update
⦁ Fix: Refresh Kali archive keyring and re-run: sudo apt install -y kali-archive-keyring && sudo apt update.

Step 2: Install NVM and Node.js (Node 20) on Kali
Screenshot reference (Step 2)

What you are doing
⦁ Install NVM (Node Version Manager) to manage Node versions cleanly.
⦁ Install Node.js 20 and set it as the default version for the shell.
Commands used
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
source ~/.bashrc
nvm –version
nvm install 20
nvm use 20
What to verify
node -v prints v20.x and npm -v prints a version number.
⦁ Re-open a new terminal and confirm Node is still available (NVM loaded).
Notes
⦁ Using Node 20 is recommended for modern CLI tooling and better compatibility with Promptfoo.
⦁ If NVM is installed but commands do not work in a new terminal, ensure your shell is bash and that ~/.bashrc contains the NVM init lines.
Common issues & fixes
⦁ Issue: nvm: command not found after installation
⦁ Fix: Run source ~/.bashrc (or start a new terminal). If you use zsh, add NVM init lines to ~/.zshrc.
⦁ Issue: Slow downloads inside a VM
⦁ Fix: This is normal. VM disk + shared network makes installs slower; avoid running multiple heavy downloads in parallel.

Step 3: Update npm and confirm Promptfoo CLI runs
Screenshot reference (Step 3)

What you are doing
⦁ Confirm your Node and npm versions.
⦁ Update npm to the latest stable version.
⦁ Run Promptfoo via npx and confirm it prints a version.
Commands used
node -v
npm -v
npm install -g npm@latest
npm -v
npx promptfoo@latest –version
What to verify
npx promptfoo@latest --version prints a version (example shown: 0.120.23).
⦁ npm ‘deprecated’ warnings are acceptable; they do not mean install failed.
Notes
⦁ The first npx promptfoo@latest run is slower because npx downloads and caches dependencies under ~/.npm/_npx/.
⦁ For faster repeated usage you can optionally install globally: npm install -g promptfoo.
Common issues & fixes
⦁ Issue: npx appears to ‘hang’ on first run
⦁ Fix: Wait a bit; it is downloading dependencies. Verify activity with ps aux | grep node or ps aux | grep npm.

Step 4: Install Ollama and verify the service is running
Screenshot reference (Step 4)

What you are doing
⦁ Install Ollama (local LLM runtime) using the official install script.
⦁ Confirm Ollama version and systemd service status.
⦁ Note: CPU-only mode is expected if no GPU is detected.
Commands used
curl -fsSL https://ollama.com/install.sh | sh
ollama –version
systemctl status ollama –no-pager
What to verify
ollama --version prints a version (example shown: 0.15.6).
systemctl status ollama shows: Active: active (running).
⦁ Ollama API is reachable: curl -s http://localhost:11434/api/tags | head returns JSON.
Notes
⦁ The installer creates/starts ollama.service and binds the local API on 127.0.0.1:11434.
⦁ CPU-only mode is slower but fine for demos; model downloads and inference will take longer.
Common issues & fixes
⦁ Issue: Ollama service not running after install
⦁ Fix: Start it: sudo systemctl enable --now ollama then re-check status.
⦁ Issue: Download progress looks stuck
⦁ Fix: Large archives can pause on slow networks; check with ps aux | grep ollama and wait.

Step 5: Pull the target model (llama2:7b-chat) and verify it is available
Screenshot reference (Step 5)

What you are doing
⦁ Download the model weights to your local machine using ollama pull.
⦁ Confirm the model appears in ollama list before moving to Promptfoo.
Commands used
ollama pull llama2:7b-chat
ollama list
What to verify
ollama list shows llama2:7b-chat with a non-zero size (several GB).
⦁ Optional quick test: ollama run llama2:7b-chat "Say: ready" returns a response.
Notes
⦁ Model pulls are the biggest downloads in this lab. Keep enough free disk space (10–15 GB recommended per 7B model).
⦁ If you later add mistral:7b and llama3:8b, expect additional multi-GB downloads.
Common issues & fixes
⦁ Issue: Model pull fails due to low disk space
⦁ Fix: Free space: sudo apt clean, remove unused models (ollama rm <model>), or expand VM disk and resize partition.
⦁ Issue: Model pull is slow
⦁ Fix: Normal on shared networks/VM. Avoid parallel downloads.

Step 6: Create Promptfoo project folder and red-team config file
Screenshot reference (Step 6)

What you are doing
⦁ Create a dedicated working directory for the demo run.
⦁ Create promptfooconfig.yaml (or promptfooconfig.yml) with Ollama provider + prompt + redteam plugins.
Commands used
mkdir -p ~/ai-redteam-promptfoo
cd ~/ai-redteam-promptfoo
nano promptfooconfig.yaml
What to verify
⦁ File exists: ls -la promptfooconfig.yaml.
⦁ Config includes provider: ollama:chat:llama2:7b-chat and redteam plugins (example: prompt-extraction, system-prompt-override).
Notes
⦁ The ‘tests’ section is used by promptfoo eval. For promptfoo redteam run, Promptfoo generates its own adversarial tests based on plugins.
⦁ To make injection targeting explicit, include an input variable in your prompt like User message: {{query}}.
Common issues & fixes
⦁ Issue: YAML indentation errors
⦁ Fix: Use 2 spaces for indentation and avoid tabs. Run npx promptfoo@latest eval to validate parsing.

Step 7: Run the automated red-team scan and interpret the CLI output
Screenshot reference (Step 7)

What you are doing
⦁ Start the red-team scan; Promptfoo will generate attack cases and run them against the model.
⦁ Review the generated test summary and confirm results complete without errors.
Commands used
npx promptfoo@latest redteam run
What to verify
⦁ You see ‘Test Generation Summary’ with plugin counts (example: 16 total tests).
⦁ Scan completes with a result line similar to: Results: X passed, Y failed, Z errors.
⦁ A report is available via promptfoo redteam report (local web UI or HTML report).
Notes
⦁ A 0% ‘attack success rate’ means attacks did not cause a policy failure under the current plugins and target prompt — the scan still ran correctly.
⦁ If scans take a long time in a CPU-only VM, reduce concurrency and/or number of tests: set maxConcurrency: 1 and reduce numTests.
Common issues & fixes
⦁ Issue: Run takes too long on VM
⦁ Fix: Reduce load: maxConcurrency: 1 and numTests: 6–10. Also test one plugin at a time.
⦁ Issue: Email verification prompt appears
⦁ Fix: Promptfoo may request email verification for red-team scans. Complete it once, then future runs proceed normally.

Step 8: View results in the Promptfoo UI and review pass/fail evidence
Screenshot reference (Step 8)

What you are doing
⦁ Open the Promptfoo results UI (served locally) and drill into the run.
⦁ Review per-plugin results and individual prompt/output evidence.
Commands used
npx promptfoo@latest redteam report
npx promptfoo@latest view
xdg-open .promptfoo/redteam/report.html
What to verify
⦁ The UI shows the run name, target provider, number of tests, and ‘Attack Success Rate’.
⦁ You can open an individual test to see the prompt, model output, and evaluation status.
⦁ Export option works if you want CSV/JSON for documentation.
Notes
⦁ Attack Success Rate is the percentage of tests that produced a vulnerability finding (fail). If it shows 0%, it means no failures were detected for that run.
⦁ For a stronger demo, compare multiple models (llama2 vs mistral vs llama3) and/or add plugins like indirect prompt injection where appropriate.
Common issues & fixes
⦁ Issue: Browser does not open automatically
⦁ Fix: Copy the localhost URL printed by Promptfoo or run xdg-open on the HTML report path.
⦁ Issue: UI loads but shows no rows
⦁ Fix: Ensure you are looking at the correct run/eval ID. Re-run redteam report to refresh the report index.
Next steps for better leraning:
⦁ Run the same scan against multiple models (mistral:7b, llama3:8b) and compare attack success rates.
⦁ Add explicit injection variable {{query}} in your prompt to make the attack surface clearer.
⦁ For faster runs on CPU, set maxConcurrency: 1 and start with numTests: 6.

Receiving Flight Signals using RTL-SDR (ADS-B Demo)

Overview
This document explains how to capture and decode live aircraft ADS-B signals using RTL-SDR and dump1090.

Prerequisites Table
Category Component / Tool Description
Hardware RTL-SDR USB Dongle A software-defined radio receiver used to capture raw RF signals from aircraft (ADS-B at 1090 MHz).
Hardware Antenna (1090 MHz) Specialized antenna tuned for ADS-B frequency to improve signal reception and range.
Software Kali Linux (or any Linux OS) Operating system used to run SDR tools and perform signal decoding.
Software dump1090 Tool ADS-B decoder that converts raw SDR signals into readable aircraft data (flight ID, position, altitude, etc.).

Optional (You Can Add Below Table)
Category Optional Component Purpose
Hardware External High-Gain Antenna Improves range and signal clarity (especially for long-distance tracking).
Software Flight Tracking Websites (e.g., FlightAware) Used to verify captured flight data with real-world information.

Prerequisite Knowledge

  • Basic Linux commands
  • Understanding of radio frequency basics
  • Awareness of aircraft tracking systems
    How Flights Operate (ADS-B)
    Aircraft broadcast ADS-B signals containing position, altitude, and identity on 1090 MHz. These are unencrypted.
    Tools Used
  • RTL-SDR USB Dongle
  • Antenna (1090 MHz)
  • Kali Linux
  • dump1090 software tool

Knowledge Base:
Dump1090 is an open-source software used to decode ADS-B (Automatic Dependent Surveillance–Broadcast) signals transmitted by aircraft.
Aircraft continuously broadcast their:
⦁ Position (Latitude & Longitude)
⦁ Altitude
⦁ Speed
⦁ Flight ID
⦁ Direction (Track)
These signals are transmitted over 1090 MHz radio frequency.
dump1090 takes raw radio signals captured by an SDR device and converts them into human-readable flight data.

Why is dump1090 Required?
Without dump1090:
⦁ RTL-SDR only captures raw radio signals (I/Q data)
⦁ You cannot understand or interpret aircraft data
With dump1090:
⦁ Raw signals ➝ Decoded aircraft information
⦁ Binary RF data ➝ Structured flight details
[Download from:
⦁ https://github.com/antirez/dump1090]

Hardware to buy:
Buy RTL-SDR Dongles (RTL2832U)
RTL-SDR Blog V3 R860 RTL2832U 1PPM TCXO HF Bias Tee SMA Software Defined Radio with Dipole Antenna Kit : Amazon.in: Electronics

Demo
Step 1: Connect RTL-SDR
Plug in the RTL-SDR device.

Step 2: Navigate to dump1090
cd dump1090
[Download from:
https://github.com/antirez/dump1090]

Step 3: Run Tool
./dump1090 –interactive

Step 4: Observe Output
You will see aircraft data like ICAO, flight number, altitude, speed, coordinates.

Step 5: Extract Coordinates
Example: 13.019, 80.206

Step 6: Validate in Maps
Paste coordinates in Google Maps.

Step 7: Cross Verify Flight
Check flight ID on FlightAware.

Conclusion
Successfully tracked real-time aircraft using SDR.