Breaking and Defending LLM-Powered Social Media Bot Detection Systems
Organizations: Department of Computer Science Reichman University Herzliya, Israel
Abstract
The rise of social media bots poses a persistent threat, enabling misinformation, opinion manipulation, and the erosion of trust in online platforms. To combat this, machine learning systems have been developed to detect and limit bot activity, but attackers continuously adapt through techniques such as adversarial learning and behavior imitation, fueling an ongoing arms race between bots and detection tools. Recent advances in large language models (LLMs) have significantly improved bot detection by enabling deeper semantic and contextual analysis of accounts and their content. However, this shift also introduces new attack surfaces, allowing adversaries to craft exploits that directly target the reasoning and generation mechanisms of LLM-based classifiers. Industry tools such as Anthropic's Claude Code Security similarly leverage LLMs for security-critical decisions, further motivating a careful study of their attack surfaces. In this work, we investigate both the offensive and defensive aspects of LLM-powered, threat-specific cybersecurity applications. While centered on the challenge of social media bot detection, our methodology and insights generalize to a broad class of LLM-powered cybersecurity systems, including phishing detection, email classification, and fraud analysis. We introduce two novel adversarial attack strategies that systematically exploit the semantic and contextual weaknesses of LLM-based classifiers, degrading their detection accuracy by up to 48%. To counter these threats, we propose a robust multi-LLM defense architecture designed to preserve detection reliability under adaptive adversarial conditions. Our solution, LSABRE (LLM-powered Social Adversarial Bot Recognition Ensemble), is a multi-LLM framework that substantially improves robustness across a range of attacks, maintaining 86% detection accuracy even under strong, adaptive adversarial pressure.
Figures & tables
| The Data | Model | Acc | TPR | FPR |
|---|---|---|---|---|
| llama3 | 0.908 | 0.993 | 0.177 | |
| Tweets per User | mistral | 0.5195 | 0.045 | 0.006 |
| gemma | 0.8925 | 0.865 | 0.08 | |
| llama3 | 0.849 | 0.84 | 0.142 | |
| Tweets per User | mistral | 0.512 | 0.027 | 0.003 |
| (sanity check performed around 6 months later) | gemma | 0.7945 | 0.649 | 0.06 |
| Attack Type | Mistral | Gemma | Llama |
|---|---|---|---|
| No Attack | 0.5195 | 0.8925 | 0.908 |
| Zero Shot | 0.527 | 0.63783 | 0.810167 |
| Few Shot | 0.5465 | 0.635167 | 0.8925 |
| Feature Guidance | 0.50883 | 0.5735 | 0.82467 |
| Classifier Guidance | 0.575167 | 0.57267 | 0.857 |
| Attack Type | Mistral | Gemma | Llama |
|---|---|---|---|
| No Attack | 0.5195 | 0.8925 | 0.908 |
| Reasoning Injection | 0.5045 | 0.4605 | 0.473 |
| Safety Injection | 0.6195 | 0.4705 | 0.5685 |
| Out Of Service Injection | 0.5255 | 0.468 | 0.421 |
| Attacker Model | Mistral | Gemma | Llama |
|---|---|---|---|
| No Attack | 0.5195 | 0.8925 | 0.908 |
| Mistral | 0.508125 | 0.561375 | 0.81175 |
| Gemma | 0.584 | 0.630375 | 0.894375 |
| Llama | 0.518125 | 0.623375 | 0.829625 |
| Defense Type | Mistral | Gemma | Llama |
|---|---|---|---|
| No Attack | 0.5195 | 0.8925 | 0.908 |
| Zero Shot Attack | 0.527 | 0.63783 | 0.810167 |
| Self Examination - Zero Shot Defense | 0.5585 | 0.63083 | 0.793167 |
| Self Examination - ICL Defense | 0.64 | 0.5805 | 0.843 |
| Self Examination - Feature Guidance Defense | 0.57983 | 0.56183 | 0.85167 |
| Defense Type | Mistral | Gemma | Llama |
|---|---|---|---|
| No Attack | 0.5195 | 0.8925 | 0.908 |
| Average Attack | 0.54983 | 0.4663 | 0.4875 |
| Self Examination - Zero Shot Defense | 0.5265 | 0.24867 | 0.38883 |
| Self Examination - ICL Defense | 0.509167 | 0.2363 | 0.25083 |
| Self Examination - Feature Guidance Defense | 0.5445 | 0.549167 | 0.80067 |
| Known Answer | 0.51467 | 0.503 | 0.8625 |
| Defense Type | Mistral | Gemma | Llama |
|---|---|---|---|
| No Attack | 0.499 | 0.5885 | 0.673 |
| Naive LLM-based | 0.53867 | 0.6785 | 0.734 |
| In Context Learning LLM-based | 0.5813 | 0.64767 | 0.72683 |
| Feature Guidance LLM-based | 0.66267 | 0.5603 | 0.633 |
| Model Attacker | Mistral | Gemma | Llama |
|---|---|---|---|
| No Attack | 0.499 | 0.5885 | 0.673 |
| Mistral | 0.70583 | 0.696167 | 0.737167 |
| Gemma | 0.559167 | 0.568 | 0.6713 |
| Llama | 0.51767 | 0.6223 | 0.6853 |
| Attack Type | Mistral | Gemma | Llama |
|---|---|---|---|
| No Attack - Baseline Average | 0.0 | 0.0445 | 0.8975 |
| Reasoning Injection | 0.252125 | 0.50625 | 0.6265 |
| Safety Injection | 0.057 | 0.50625 | 0.38075 |
| Out Of Service Injection | 0.147 | 0.6223 | 0.306625 |
| Method | Acc | TPR | FPR |
|---|---|---|---|
| Detection Before Attack | 0.90025 | 0.929 | 0.1285 |
| Detection After Attack | 0.725438 | 0.56083 | 0.1105416 |
| Ensemble Results | 0.8623 | 0.855 | 0.13033 |
| Type | Model | Attack | Model | Acc | TPR | FPR |
|---|---|---|---|---|---|---|
| llama3 | 0.8165 | 0.783 | 0.15 | |||
| Zero Shot Rewrite | mistral | 0.522 | 0.046 | 0.002 | ||
| gemma | 0.6 | 0.264 | 0.064 | |||
| llama3 | 0.8485 | 0.847 | 0.15 | |||
| mistral | Few Shot Rewrite | mistral | 0.505 | 0.01 | 0.0 | |
| gemma | 0.565 | 0.194 | 0.064 |
| Type | Attack | Model | Acc | TPR | FPR |
|---|---|---|---|---|---|
| llama3 | 0.473 | 0.123 | 0.177 | ||
| Reasoning Prompt Injection | mistral | 0.5045 | 0.015 | 0.006 | |
| gemma | 0.4605 | 0.001 | 0.08 | ||
| llama3 | 0.5685 | 0.314 | 0.177 | ||
| LLM Manipulation | Safety Alignment Prompt Injection | mistral | 0.6195 | 0.245 | 0.006 |
| gemma | 0.4705 | 0.021 | 0.08 |
| Type | Injection | Technique | Model | Acc | TPR | FPR |
|---|---|---|---|---|---|---|
| llama3 | 0.394 | 0.126 | 0.338 | |||
| Self Examination - Zero Shot | mistral | 0.5025 | 0.007 | 0.002 | ||
| gemma | 0.357 | 0.003 | 0.289 | |||
| llama3 | 0.634 | 0.394 | 0.126 | |||
| Self Examination - ICL | mistral | 0.5175 | 0.036 | 0.001 | ||
| gemma | 0.5 | 0.0 | 0.0 |
| Type | Rewrites By | Technique | Model | Acc | TPR | FPR |
|---|---|---|---|---|---|---|
| llama3 | 0.7805 | 0.926 | 0.365 | |||
| Self Examination - Zero Shot | mistral | 0.5315 | 0.063 | 0.0 | ||
| gemma | 0.5515 | 0.266 | 0.163 | |||
| llama3 | 0.83 | 0.902 | 0.242 | |||
| Mistral - Zero Shot Rewrite | Self Examination - ICL | mistral | 0.6115 | 0.345 | 0.122 | |
| gemma | 0.5515 | 0.167 | 0.064 |
| Type | Injection | Technique | Model | Acc | TPR | FPR |
|---|---|---|---|---|---|---|
| llama3 | 0.9315 | 0.983 | 0.12 | |||
| Naive LLM-based | mistral | 0.01 | 0.02 | 1.0 | ||
| gemma | 0.5115 | 0.988 | 0.965 | |||
| llama3 | 0.4965 | 0.968 | 0.975 | |||
| Reasoning | In Context Learning | mistral | 0.0365 | 0.01 | 0.937 | |
| gemma | 0.5 | 0.97 | 0.97 |
| Type | Rewrites By | Technique | Model | Acc | TPR | FPR |
|---|---|---|---|---|---|---|
| llama3 | 0.774 | 0.916 | 0.368 | |||
| Naive LLM-based | mistral | 0.6075 | 0.226 | 0.011 | ||
| gemma | 0.758 | 0.792 | 0.276 | |||
| llama3 | 0.773 | 0.94 | 0.394 | |||
| Mistral - Zero Shot Rewrite | In Context Learning | mistral | 0.695 | 0.391 | 0.001 | |
| gemma | 0.7495 | 0.771 | 0.272 |