Penetration testing
Garak for Beginners: Test an LLM for Security Weaknesses
garak is an open-source scanner for large language models. It sends a battery of test prompts, called probes, and checks whether the model fails, for example by following injected instructions. It is a good first tool for AI security testing. Test only models and applications you own or have written permission to test. Read prompt injection explained first.
Install
python3 -m venv garak-env && source garak-env/bin/activatepython3 -m pip install garakpython3 -m garak --list_probesshows the probes available in your version.
Run a Small Scan
Start with a small local model so nothing leaves your machine. The Hugging Face gpt2 model is tiny and good for learning the workflow, even though its results say little about modern models:
python3 -m garak --model_type huggingface --model_name gpt2 --probes promptinject
The first run downloads the model, so it can take a few minutes. Hosted models need an API key you own and a different --model_type; see the garak documentation, and watch the cost.
Read the Results
garak prints a summary per probe and detector and tells you where the full report is saved. A failure means the model did the unwanted thing for some of the prompts. Open the report and read the actual prompts and replies, because the pass rate alone does not tell you the impact.
What a Scanner Cannot Do
- It tests the model, not your whole application, its permissions or its data.
- It cannot tell you what a successful injection would be able to do in your product.
- Manual testing of the application around the model is still needed; see AI red teaming for beginners.
Where It Fits
AI security testing is the subject of EC-Council's COASP; see the COASP exam guide. The web and API base that AI applications sit on is taught in our Application Security course.
Sources and Further Reading
Want to start with the web and API testing base first? Book free trial classes. Contact us or call +91 86868 92922.
Courses Mentioned in This Guide
More Guides
AI Red Teaming for Beginners: What Testers Actually Do
AI red teaming explained: what testers attack in AI applications, prompt injection, data poisoning and agent risks, how to practice legally and the skills needed.
Read the guide →EC-Council COASP: Exam Format, Eligibility and 10 Modules
What the EC-Council COASP exam looks like: 6 hours, 65 questions plus 5 practical challenges, 10 AI red teaming modules and who is ready for it.
Read the guide →What Is VAPT? Vulnerability Assessment vs Penetration Testing
VAPT explained: how a vulnerability assessment differs from a penetration test, the types of VAPT, how an engagement runs and what the final report contains.
Read the guide →Penetration Testing Phases Explained, Step by Step
The phases of a penetration test, from scoping and reconnaissance to exploitation, reporting and retesting, with what happens and what is produced in each.
Read the guide →Start Your Cyber Security Career
Talk to a counselor, choose the right course for your goals, and get the fee, syllabus and next batch dates in writing.
- Call+91 86868 92922
Open 7 days: Mon to Fri 8:30 AM to 8:30 PM IST
Sat and Sun 10 AM to 6 PM IST - Emailinfo@hackingtrainer.com
- VisitGround Floor, G-3, Sri Venkatasai Nest, Kallu Compound Road, Nagarjuna Nagar Colony, Yella Reddy Guda, Ameerpet, Hyderabad – 500073
Open in Google Maps