Inspiration Many people are using AI to make money in today's world. On TikTok, last week, a streamer was doing live stream advertising on his page saying "I make 80k a month. ask me anything" When I entered his room, he was legibly answering questions. So I asked him "Can you code?" he said "nope I don't need to code I use AI for that". Ok then asked him a follow-up question on that same TikTok stream - "Hey sorry but how do you that the code AI is writing is correct?" He ignored it first time, a bit annoyed but I again pasted it from copy-paste buffer on iOS device then. "How do you know that the code that AI is writing for your Ad tech business is correct?" then he answered, this time more annoyed, "I don't code bro, I use AI and if I need to code with AI I will hire an Indian". I then joked to him, "Oh cool, ty. And I'm Indian lol" But anyways the inspiration is today AI can write code and lots and lots of it but if it hallucinates, not body can Catch that hallucinated error unless every single LoC is reviewed genuinely by 2/3 developers. This problem is even more severe in C/C++/Objective-C/C++ code bases where I have seen Codex/Claude don't really write code with principles and artistic and aesthetics that I wish I could put. For example, Codex likes to copy paste headers from my core-layer into concurrent-layer and rename those test-macros by prefixing with CONCUR or sorts but is that a good design? so anyway if AI keeps coding and hallucinates and say hash include package FDBMS instead of FMDB package on Objective-C and really goes on pod install and sorts and dev does not notice changes etc and LLM also does not notice wow at binary level this code is doing different things (capabilities set is bigger than asked by developer in first case) then we say the code has drifted at binary level. like dev may tell AI code oh I need only file.open, file.read and file.writes and process.fork and process.execve for this code in C/C++ app, then my tool will record that promise as baseline by inserting that C/C++/Obj-C software from 3 angles (I call it as planes or axes ) like at source level of code (.c/.cpp) what is code doing that was generated by AI remember, than at binary level what can we say using its instruction sets (using caps framework or other ghidra frameworks) it doing (like is it sending data over network) and at runtime what is really doing -- runtime is confirmatory so CBD (CodeBinaryDrift) records that drifts and if it finds violations it rejects that update (of code say in git)
What it does
This tool acts as Security-Checks tool just like Codex Security but with laser focussed on C/C++ languages for first cut (because APT attackers like to use these low level languages say for C2C after infiltration and for exflirtation) . And it detects if the code behavior has changed / or shifted to dangerous level from what it was initially supposed to do.
We record BASELINE behavior by asking Developer : "what capabilities u think your code needs?" dev tells that and we record it . (right now this peace in demo is not implemented i.e. UX is given less significance than prove concept end-to-end on dev-machine)
BASELINE it says oh it has capabilities set like :
BASELINE = {file.open, file.read, file.write, process.fork, process.execve}
then down hill one day an , say a supply chain attack happens like SUNSTORM Orion or whatever, and attacker gets hold of weakest link in software supply chain and injects his malicious code based on AI hallucinations (attacker may learn where did AI hallucinated by feeding millions and billions of prompts to LLM and using Distillation mechanisms to detect such things. it is really called slop squatting attack sometimes today)
So say RELEASE_N got more capabilities than intended
RELEASE_N = {file.open, file.read, file.write, process.fork, process.execve, network.send}
Notice the new capability that got introduced, this could be due to AI code hallucinating that thought FDBMS.h is a genuine import in obejctive-c instead of real cocoa pod FMDB . just saying for assumptions. (I tested and chatgpt does not halluciantes for FDBMS for FMDB as of now)
So this drift in behavior is captured by CBD
basically here intersection of two sets were expected to be null set but here it got non-null that's when say a git push can be rejected by CI/CD pipelines
BASELINE RELEASE_N = {network.send}
so really it looks for "fixed static point" here
How we built it
Basically we try to analyze intents of the Software (the Code) along the 3 axes discussed above. Look at source code and see what did the AI code generate, then look at binary/elf and analyze it and see via powerful tool CAPA (checks capabilities using rules written by experts in cybersecurity world) and finally at runtime how the code is behaving. So if all those three angles or axes are in unison with each other we say the code has not shifted from its contract at the binary level. Since this I wanted to do in C or C++ because I want to run it along developer-machine on same machine, so I decided to use C/C++ plus I have been coding in C/C++/Objective-C (ios) since Oct 2000. If the behavior has shifted means if the capabilities set is now inflated like a balloon that means someone added code that is not desired at say SLA level at the minimum.
Challenges we ran into
-- How to make sure CAPA rules can be run within bounds of exec-core's sandbox (i fixed it by running the capa process as a separate python-proxy for now which yeah i know defeats purpose of exec-core but curently we still track that task via capa tool). Currently we use the concept of tag-on-tag-off (like if you travel in CalTrain from SF to MV you need to tag on at SF and tag off at MV to get money back in clipper) same way we say CAPA tags on means ok an analyssis is already underway hold on and only when it gets tag off, then it makes it a concrete docuemtned trustable evidence.) -- How to use Codex on AWS cosnole (could not find time to reasearch but wasted lot of time using codex on mac and feeding it outputs from ubuntu on aws remotely sshed machine that i had to for testing ebpf) -- How to store facts ? how to use TELL and ASK of KB as taught in AIMA book knowledge-based goal-based agent -- Codex Security kicked in and took away time Trust Access Security something which I lost sometime trying to figure out (I learnt about this hackathon in Caltrain last Friday on July 17 while going home from mv to sf and I have not used codex much but still decided to try my skills )
Accomplishments that we're proud of
-- It uses proper loop Ontology -> Epistemology -> Methodology -> Axiology pathways so that framewrok can be scaled in future -- Reasoning agent is just a thin wrapper on GPT5.6sol model which acts as a reasoning agent but not the heart of the system
What we learned
- How to implement a goal-based agent that uses its acquired knowledge to do next futrure actions (percept->ction mapping) really the learning for agent here itself (recursive answer sorry)
What's next for Code Binary Drift
-- Use Learning to make Security AI Agent more intelligent epsitemologically -- Support other languages-emitted binaires like ByteCode for JVM
Log in or sign up for Devpost to join the conversation.