# 1188th Place Solution for the AI Village Capture the Flag @DEFCON31 Competition

I will be honest, I had no idea how to progress in this competition. I was into Machine Learning but had never even heard of cybersecurity or CTF on ML models. In short, I was new and learned a lot.
I could not complete any of the challenges except the test one whose solution even the host provided. In this discussion, I will be providing links on getting started or casually exploring cybersecurity in ML to beginners like me who didn't understand anything. I will also be listing a very short analysis on how top solutions solved the challenges. please take them as a hint if you get stuck somewhere and not just implement them without understanding the concept.
Must Watch Links:
[AI poisoning](https://www.youtube.com/watch?v=a92SWvqgMCE)
[PPT on AI poisoning](https://www.bucks.edu/media/bcccmedialibrary/con-ed/itacademy/fos2022/Casey-AI-Poisoning-pdf.pdf)
[Fooling AI article](https://medium.com/swlh/how-to-fool-artificial-intelligence-fcf230bf37e)
HINTS SECTION (Try all challenges only then read)
Test - answer given in demo notebook
Clusters 1 - Try to find high scoring numerical value in dataset, use that as a key to get the flag.
Clusters 2 - count of clusters is asked. one easy solution is to just randomly check all values 1 … solution.  Credits: solution for place 3.
Cluster 3 - use the tnse_model model with config tsne_model = TSNE(perplexity=17, n_components=2, init='pca', n_iter=2500, random_state=23) and plot the output as a scatterplot with annotations.
MNIST - Count of pixel values is just throwing away the solution at you.
Count CIFAR - Unsolved
Granny 1 - Difficult Challenges ( would suggest solving at last ) hint would be using model that gives similar output to the given model, ultra hint modified MobileNetV2. then use Basic Iterative Method FGSM.
Granny 2 - similar to Granny 1 - Basic Iterative Method FGSM again. refer to 3rd place solution
[here](https://www.kaggle.com/code/mrmldjr/granny-1-and-2-solutions-ai-village-ctf/)
Granny 3 - Unsolved
Passphrase - similar to granny find a model that gives similar output as example. solution
[here](https://www.kaggle.com/code/mrmldjr/passphrase-solution-ai-village-ctf-defcon31)
Pixelated - try sending server different HTML like queries as input you will get the answer in a few tries.
Spanglish - send flag as input ;D
Hush - answer is a quote. try giving multiple words/letters as input to pyttsx3.
Pirate Flag - Multiple solutions, try asking the model directly for solution as if asking another human.
semantle - try n number of english words, if you get a good score, try synonyms. Ans = rocks in sky.
semantle 2 - try same solution with 5 word sets.
inversion - a bit difficult but could be solved using guide
[here](https://www.kaggle.com/code/cdeotte/solutions-d3fc0n-ctf-lb-0-894#Inference-(id:-inference)----400-Points)
, if could not solve hint "We then take the first column response[:,0] and reshape this into a 32x32 image. This is our first letter! We display all 8 letters below". still difficult? find solution
[here](https://www.kaggle.com/code/mrmldjr/inversion-solution-ai-village-ctf-defcon31)
Flag 1-6 : prompt injection. ask model for flag.
guess who's back - just give a punchline from after the phrase guess who's back.
Pickle - change pickled RCE obj to safe pickle
Whats my IP? - change IP of
[joe@simpson.com](mailto:joe@simpson.com)
what's my IP? 2 - find the whole set this time.
This concludes all the found solutions.
Special reference:
[Solutions Notebook 1](https://www.kaggle.com/code/asalhi/ctf-23-flags-solution)
[Solution Place 3](https://www.kaggle.com/competitions/ai-village-capture-the-flag-defcon31/discussion/454720)
Best of luck hacking!!