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.
Where This Guide Fits in Our Training
- VAPT Training in Hyderabad: the 12-week VAPT Track: application, network and Active Directory testing, and the reports
- Penetration Testing Course in Hyderabad: the VAPT Track, from fundamentals to professional testing
- Cyber Security Course with Practical Labs in Hyderabad: how the labs work and what you practise in each class
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 →Types of VAPT: Web, Mobile, Network, API and Cloud Explained
The main types of VAPT (vulnerability assessment and penetration testing): web, API, mobile, thick client, network, wireless and cloud, plus black, grey and white box testing.
Read the guide →VAPT Tools: What Testers Use at Each Stage and Why
The tools used in VAPT, grouped by stage: discovery, scanning, web and API testing, exploitation, passwords, network analysis, Active Directory, mobile and reporting.
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