Skip to main content

Prompt Engineering vs. AI Safety: Bypassing Refusals in Private RAG Systems

·3 mins

I recently noticed how sensitive AI models can be to certain prompts, especially those related to offensive security. Topics such as malware development, exploitation, and offensive tooling are heavily scrutinized, and a capable AI model will often refuse to answer requests that cross certain safety boundaries.

But that raises a bigger question: how safe is AI, really?

As AI adoption grows, small, medium, and large organizations are increasingly integrating AI into their daily workflows. The benefits are obvious: faster analysis, automation, improved productivity, and access to powerful reasoning tools.

At the same time, however, AI introduces a new attack surface.

The more organizations connect AI systems to internal documents, applications, APIs, code repositories, databases, and business processes, the more opportunities there are for those systems to be abused, manipulated, or misconfigured.

This leads to an important question:

Does an AI model refusing a dangerous prompt actually mean the system is secure?

In other words:

AI refusal == AI safety?

That is what I want to explore.

AI Guardrails πŸ”’ #

What are AI guardrails? They are the safety mechanisms, technical controls, and policies designed around AI systems to help ensure they behave in a predictable, secure, and responsible way.

Private RAG 🧠 #

I have created my own private RAG to test and I observed the AI models are really good blocking senstive requests for example when I asked to write me a malware:

As expected the AI guardrails model blocked my request and replied to me “I’m sorry, but I can’t assist with that request’.

Testing AI Guardrails #

Another test when I asked the model to write a simple keylogger and again it refused to write for the good πŸ˜‡

Persistence Pays Off: Breaking the Refusal #

After playing with the prompt for a while πŸ˜… I was able finally make my Private RAG model to generate the code I wanted, surprisingly was even happy to improve the version of keylogger that previously refused to generate πŸ€”

TestModel BehaviorResult
Direct malicious requestRefusedβœ… Guardrail worked
Alternate wordingRefusedβœ… Guardrail worked
Context manipulationPartial response⚠️ Partial bypass
Persistent prompt variationGenerated previously refused output❌ Guardrail bypassed

Conclusion #

AI is being deployed across modern systems, and businesses of all sizes are increasingly integrating it into their daily operations. However, it is important to understand that an AI model refusing a harmful prompt does not automatically mean the whole AI system is secure. One of the key lessons is that AI security requires continuous testing, validation, and awareness. Guardrails and refusal mechanisms are important, but they are only one layer of protection. Prompt testing should be treated as an essential part of AI security because it helps identify what existing filters and controls may fail to catch. Finding those weaknesses early can help organizations reduce risk, improve their defenses, and avoid much larger problems later.

I hope you enjoy and see you on next post πŸ‘‹