{"id":5012,"date":"2025-01-24T16:05:12","date_gmt":"2025-01-24T08:05:12","guid":{"rendered":"https:\/\/mayanknauni.com\/?p=5012"},"modified":"2025-01-24T16:16:34","modified_gmt":"2025-01-24T08:16:34","slug":"leveraging-generative-ai-for-critical-infrastructure-security-llm-agents","status":"publish","type":"post","link":"https:\/\/mayanknauni.com\/?p=5012","title":{"rendered":"Leveraging Generative AI for Critical Infrastructure Security: LLM Agents"},"content":{"rendered":"<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5015\" src=\"https:\/\/i0.wp.com\/mayanknauni.com\/wp-content\/uploads\/2025\/01\/Capture.jpg?resize=1861%2C742&#038;ssl=1\" alt=\"\" width=\"1861\" height=\"742\" srcset=\"https:\/\/i0.wp.com\/mayanknauni.com\/wp-content\/uploads\/2025\/01\/Capture.jpg?w=1861&amp;ssl=1 1861w, https:\/\/i0.wp.com\/mayanknauni.com\/wp-content\/uploads\/2025\/01\/Capture.jpg?resize=300%2C120&amp;ssl=1 300w, https:\/\/i0.wp.com\/mayanknauni.com\/wp-content\/uploads\/2025\/01\/Capture.jpg?resize=1024%2C408&amp;ssl=1 1024w, https:\/\/i0.wp.com\/mayanknauni.com\/wp-content\/uploads\/2025\/01\/Capture.jpg?resize=768%2C306&amp;ssl=1 768w, https:\/\/i0.wp.com\/mayanknauni.com\/wp-content\/uploads\/2025\/01\/Capture.jpg?resize=1536%2C612&amp;ssl=1 1536w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/p>\n<div class=\"flex max-w-full flex-col flex-grow\">\n<div class=\"min-h-8 text-message flex w-full flex-col items-end gap-2 whitespace-normal break-words text-start [.text-message+&amp;]:mt-5\" dir=\"auto\" data-message-author-role=\"assistant\" data-message-id=\"00e263f0-4668-49db-afbb-981c4c10fc82\" data-message-model-slug=\"o1\">\n<div class=\"flex w-full flex-col gap-1 empty:hidden first:pt-[3px]\">\n<div class=\"markdown prose w-full break-words dark:prose-invert light\">\n<p>As a PhD student\u00a0 &amp; researcher I&#8217;ve spent the better part of my studies exploring ways to protect critical infrastructure systems. Today, I\u2019d like to share my excitement about <strong>CyberBoT<\/strong>\u2014a tool I\u2019ve developed that marries good old-fashioned security scanning with the brains of Generative AI (namely GPT-4). If you work with, or are simply curious about, both IT and OT (Operational Technology) environments, I think you\u2019ll find CyberBoT an interesting new approach to vulnerability assessment.<\/p>\n<hr \/>\n<h2>Why Critical Infrastructure Security Is So Challenging<\/h2>\n<p>Securing critical infrastructure is no walk in the park. We\u2019re not just dealing with typical IT servers and desktops here; there are also industrial control systems (ICS) humming away in factories, power plants, and water treatment facilities. These ICS setups speak their own set of protocols, come with a bunch of specialized hardware, and often have strict uptime requirements. Basically, if something breaks in an ICS environment, it can cause serious real-world disruptions.<\/p>\n<p>Historically, teams juggling IT and OT security have had to navigate two very different worlds. That\u2019s where the idea of using an AI assistant came to me: Why not have a tool that not only knows how to handle traditional IT systems but also recognizes and cares about ICS protocols and constraints?<\/p>\n<hr \/>\n<h2>Introducing CyberBoT: AI Meets Security Scanning<\/h2>\n<p>So, how does <strong>CyberBoT<\/strong> actually work? Here\u2019s a quick rundown:<\/p>\n<ol>\n<li><strong>Intelligent Port Scanning<\/strong><br \/>\nCyberBoT starts by probing typical ICS ports, think port 102 for Siemens S7 or port 502 for Modbus\u2014using <strong>Nmap<\/strong>. This is your go-to step to see which industrial services might be active.<\/li>\n<li><strong>ICS Protocol Detection<\/strong><br \/>\nIf the scan picks up on protocols like Modbus, DNP3, BACnet, S7, or EtherNet\/IP, CyberBoT can automatically switch to deeper, specialized Nmap scripts that are tailored to each protocol\u2019s quirks.<\/li>\n<li><strong>GPT-4 Integration<\/strong><br \/>\nHere\u2019s where it gets really fun. Using <strong>LangChain<\/strong>, the scan results are fed into <strong>GPT-4<\/strong>. The AI will categorize findings into IT vs. OT concerns, look for possible lateral movement opportunities, and even reflect on past security incidents if they\u2019re relevant. In short, it\u2019s not just telling you \u201cPort X is open;\u201d it\u2019s telling you why that might be a real problem.<\/li>\n<li><strong>Exploit Database Check<\/strong><br \/>\nIf you\u2019ve ever rummaged through ExploitDB looking for known vulnerabilities, you\u2019ll appreciate that CyberBoT does this step automatically. It queries the database for discovered services and highlights any exploits or proof-of-concepts that might be floating around.<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-5023\" src=\"https:\/\/i0.wp.com\/mayanknauni.com\/wp-content\/uploads\/2025\/01\/GPT-Analysis.png?resize=1594%2C527&#038;ssl=1\" alt=\"\" width=\"1594\" height=\"527\" srcset=\"https:\/\/i0.wp.com\/mayanknauni.com\/wp-content\/uploads\/2025\/01\/GPT-Analysis.png?w=2481&amp;ssl=1 2481w, https:\/\/i0.wp.com\/mayanknauni.com\/wp-content\/uploads\/2025\/01\/GPT-Analysis.png?resize=300%2C99&amp;ssl=1 300w, https:\/\/i0.wp.com\/mayanknauni.com\/wp-content\/uploads\/2025\/01\/GPT-Analysis.png?resize=1024%2C338&amp;ssl=1 1024w, https:\/\/i0.wp.com\/mayanknauni.com\/wp-content\/uploads\/2025\/01\/GPT-Analysis.png?resize=768%2C254&amp;ssl=1 768w, https:\/\/i0.wp.com\/mayanknauni.com\/wp-content\/uploads\/2025\/01\/GPT-Analysis.png?resize=1536%2C508&amp;ssl=1 1536w, https:\/\/i0.wp.com\/mayanknauni.com\/wp-content\/uploads\/2025\/01\/GPT-Analysis.png?resize=2048%2C677&amp;ssl=1 2048w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>For those who love poking around the code, you can find it all on my <a href=\"https:\/\/github.com\/mayanknauni\/ci-genai-agent.git\" target=\"_new\" rel=\"noopener\"><strong>GitHub<\/strong><\/a>.<\/p>\n<\/div>\n<p>&nbsp;<\/p>\n<div class=\"markdown prose w-full break-words dark:prose-invert light\">\n<hr \/>\n<h2>What\u2019s Special &amp; How to Stay Safe<\/h2>\n<h3>1. Chain-of-Thought Prompting<\/h3>\n<p>I use a guided prompt that nudges GPT-4 to think step by step, but still keeps the final output clear and concise. This helps avoid \u201challucinations\u201d and ensures you get methodical reasoning.<\/p>\n<h3>2. Automatic CVE Extraction<\/h3>\n<p>Whenever the AI references a CVE, CyberBoT automatically flags and grabs that data. This makes cross-referencing a breeze.<\/p>\n<h3>3. ICS-Aware Scanning<\/h3>\n<p>Because ICS systems can be extra delicate, CyberBoT includes protocol-specific checks to make scanning safer. We definitely don\u2019t want to accidentally cause a production line to halt or a substation to freak out.<\/p>\n<h3>4. Safety Controls<\/h3>\n<p>CyberBoT won\u2019t just blindly run scripts without warning you first. It\u2019ll let you know if something might be risky before you pull the trigger.<\/p>\n<hr \/>\n<h2>Using CyberBoT Wisely<\/h2>\n<ul>\n<li><strong>Always Have Authorization<\/strong>: Seriously, only scan systems you have explicit permission to test. That\u2019s a legal and ethical must.<\/li>\n<li><strong>Double-Check Findings<\/strong>: GPT-4 is awesome, but it can still miss things or misinterpret them. Treat the AI\u2019s output as a starting point, and validate using official documentation.<\/li>\n<li><strong>Remember OT Context<\/strong>: Industrial environments often have zero tolerance for downtime. Plan your scans accordingly; messing with ICS in production can have real-world consequences.<\/li>\n<li><strong>Keep an Eye on Impact<\/strong>: Even a basic Nmap scan can cause some hiccups. Monitor the target systems closely while CyberBoT does its thing.<\/li>\n<\/ul>\n<hr \/>\n<h2>Under the Hood: How It All Comes Together<\/h2>\n<p>CyberBoT relies on:<\/p>\n<ul>\n<li><strong>Streamlit<\/strong> for an easy-to-use interface<\/li>\n<li><strong>Nmap<\/strong> (through <code>python-nmap<\/code>) to handle scanning<\/li>\n<li><strong>LangChain<\/strong> to plug GPT-4 into the pipeline<\/li>\n<li><strong>Custom ICS NSE scripts<\/strong> for protocol-specific scanning<\/li>\n<li><strong>Regex<\/strong> for spotting CVEs in GPT-4\u2019s output<\/li>\n<li><strong>searchsploit<\/strong> for hooking into ExploitDB<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5014\" src=\"https:\/\/i0.wp.com\/mayanknauni.com\/wp-content\/uploads\/2025\/01\/flow.png?resize=809%2C630&#038;ssl=1\" alt=\"\" width=\"809\" height=\"630\" srcset=\"https:\/\/i0.wp.com\/mayanknauni.com\/wp-content\/uploads\/2025\/01\/flow.png?w=809&amp;ssl=1 809w, https:\/\/i0.wp.com\/mayanknauni.com\/wp-content\/uploads\/2025\/01\/flow.png?resize=300%2C234&amp;ssl=1 300w, https:\/\/i0.wp.com\/mayanknauni.com\/wp-content\/uploads\/2025\/01\/flow.png?resize=768%2C598&amp;ssl=1 768w\" sizes=\"auto, (max-width: 809px) 100vw, 809px\" \/><\/p>\n<div class=\"flex w-full flex-col gap-1 empty:hidden first:pt-[3px]\">\n<div class=\"markdown prose w-full break-words dark:prose-invert light\">\n<hr \/>\n<h2>What\u2019s Next?<\/h2>\n<p>I see a whole lot of possibilities for future development:<\/p>\n<ul>\n<li><strong>Deeper Protocol Analysis<\/strong>: Add more ICS protocol analyzers for even greater coverage.<\/li>\n<li><strong>Attack Path Visualization<\/strong>: Maybe generate a graphical or more detailed representation of how attackers might leapfrog across systems.<\/li>\n<li><strong>ICS-Focused Databases<\/strong>: Tie in specialized OT vulnerability databases to sharpen the AI\u2019s recommendations.<\/li>\n<li><strong>Machine Learning on ICS Data<\/strong>: Train domain-specific models that pick up on patterns unique to industrial environments.<\/li>\n<li><strong>Compliance Reporting<\/strong>: Generate official-looking audit reports for your compliance team at the click of a button.<\/li>\n<\/ul>\n<hr \/>\n<h2>Wrapping Up<\/h2>\n<p>At the end of the day, <strong>CyberBoT<\/strong> is my attempt to bring a little AI magic to a very real-world problem: protecting the systems that keep our critical infrastructure running. It\u2019s an open-source project, so feel free to give it a spin, contribute code, or just share any ideas you might have.<\/p>\n<p><strong>Final Word<\/strong>: AI tools can be a huge help, but they aren\u2019t a silver bullet. Keep a holistic view, blend advanced scanning with expert judgment, watch out for system stability, and focus on the bigger security picture. Happy scanning, and stay safe out there!<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"mb-2 flex gap-3 empty:hidden -ml-2\">\n<div class=\"items-center justify-start rounded-xl p-1 flex\">\n<div class=\"flex items-center\"><\/div>\n<\/div>\n<\/div>\n<hr \/>\n<p class=\"whitespace-pre-wrap break-words\"><em>Note: This tool is for research and authorised testing only. Always ensure proper authorisation before conducting any security assessments on critical infrastructure systems.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>As a PhD student\u00a0 &amp; researcher I&#8217;ve spent the better part of my studies exploring ways to protect critical infrastructure systems. Today, I\u2019d like to share my excitement about CyberBoT\u2014a tool I\u2019ve developed that marries good old-fashioned security scanning with&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[79,53,75],"tags":[158,78,125],"class_list":["post-5012","post","type-post","status-publish","format-standard","hentry","category-artificial-intelligence","category-cyber-security","category-industry-4-0","tag-ci","tag-cyber-physical-systems","tag-genai"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/mayanknauni.com\/index.php?rest_route=\/wp\/v2\/posts\/5012","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mayanknauni.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mayanknauni.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mayanknauni.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mayanknauni.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5012"}],"version-history":[{"count":8,"href":"https:\/\/mayanknauni.com\/index.php?rest_route=\/wp\/v2\/posts\/5012\/revisions"}],"predecessor-version":[{"id":5027,"href":"https:\/\/mayanknauni.com\/index.php?rest_route=\/wp\/v2\/posts\/5012\/revisions\/5027"}],"wp:attachment":[{"href":"https:\/\/mayanknauni.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5012"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mayanknauni.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5012"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mayanknauni.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5012"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}