Kimsuky’s Offline AI Arsenal: When State-Sponsored Hackers Build Their Own LLM Stack for Phishing and Malware Automation

Listen to this Post

Featured Image

Introduction:

North Korea’s Kimsuky hacking group has crossed a critical threshold in offensive cyber operations. No longer content with typing prompts into public chatbots, this Reconnaissance General Bureau unit has begun assembling a proprietary offline AI stack—complete with local large language models (LLMs), retrieval-augmented generation (RAG) pipelines, and AI-assisted coding tools—to automate phishing, accelerate malware development, and analyze exfiltrated data without exposing sensitive intelligence to cloud-based services. South Korean security firm Genians uncovered this infrastructure after months of tracking, revealing that Kimsuky is in a “research and knowledge acquisition” phase, systematically integrating existing AI tools into its attack workflow rather than training models from scratch. For defenders, this marks a paradigm shift: AI-generated lures are now polished enough to erode traditional detection tells, forcing security teams to focus on behavioral indicators rather than content quality.

Learning Objectives:

  • Understand how Kimsuky deploys offline LLMs (Ollama, GPT4All, Msty) and RAG to process stolen documents and generate convincing phishing lures without cloud exposure.
  • Identify the attack chain—from LNK files and PowerShell loaders to GitHub-based C2 and AsyncRAT payloads—and learn to detect these indicators.
  • Acquire practical commands and detection strategies for hunting AI-assisted intrusions across Linux and Windows environments.

You Should Know:

1. The Offline AI Stack: Components and Purpose

Kimsuky’s offline AI environment is built from readily available open-source tools, assembled with clear operational intent. Genians identified three core LLM runners—Ollama, GPT4All, and Msty—configured and executed on infrastructure linked to the group. Each serves a distinct purpose:

  • Ollama: A lightweight framework for running LLMs locally. Genians observed that Ollama generated the cryptographic keys created on first launch, confirming active deployment rather than mere download.
  • GPT4All: An ecosystem for running LLMs on consumer-grade hardware. Crucially, it carried a configured localdocs_v3.db—the database used by its LocalDocs RAG feature—indicating the group connected documents in its possession to an AI system for private querying.
  • Msty: A local LLM client that complements the other tools, providing a user-friendly interface for model interaction.

Beyond these runners, the group collected developer libraries including LLaMaSharp, Microsoft’s Semantic Kernel, and Microsoft.Agents.AI—components for building AI functions into custom C and .NET software. They also deployed OpenAI’s Whisper for speech-to-text transcription and Cursor, an AI-powered code editor, to accelerate malware development.

Why Offline Matters: By running AI locally, Kimsuky prevents conversation data and stolen intelligence from being transmitted to external AI services, reducing the risk of exposure and evading the monitoring that cloud-based AI queries might attract. This operational security measure is particularly attractive for a state-sponsored threat actor handling sensitive diplomatic, military, and financial intelligence.

  1. The Attack Chain: From LNK to AsyncRAT via GitHub C2

Kimsuky’s infection chain follows a well-established pattern, now augmented by AI-generated lures. The typical sequence unfolds as follows:

Step 1: AI-Generated Decoy Documents. The group uses generative AI to craft highly convincing phishing lures—often themed around virtual assets, investment strategies, or fintech services. These documents employ natural language, polished formatting, and structures mimicking legitimate business materials to increase user trust.

Step 2: Malicious LNK Files in ZIP Archives. Phishing emails contain ZIP archives with malicious LNK (shortcut) files. When executed, the LNK file runs an obfuscated PowerShell loader via command-line arguments.

Step 3: PowerShell Reconnaissance. The PowerShell script collects extensive system information: OS version and architecture, system configuration, PC type, installation and boot history, and running processes. This intelligence helps attackers assess the compromised environment and plan follow-on operations.

Step 4: GitHub-Based C2. Kimsuky abuses public GitHub repositories as command-and-control infrastructure. These repositories store configuration files, PowerShell scripts, and encrypted payloads. The group uses Git-based C2 not only for command delivery but also for malware development, stolen data management, and AI technology research.

Step 5: AsyncRAT Deployment. The final payload is often AsyncRAT, an open-source remote access trojan. Encrypted AsyncRAT binaries are disguised as image files (e.g., fox.png) and distributed via the GitHub C2 channels.

Detection Commands:

Windows – Hunt for LNK Execution and PowerShell Activity:

 Find recently created LNK files in user directories
Get-ChildItem -Path C:\Users\ -Recurse -Filter .lnk | Where-Object { $_.CreationTime -gt (Get-Date).AddDays(-7) }

Search PowerShell logs for suspicious encoded commands
Get-WinEvent -LogName "Windows PowerShell" | Where-Object { $_.Message -match "Base64|EncodedCommand" }

Check for hidden scheduled tasks (common persistence mechanism)
schtasks /query /fo LIST /v | findstr /i "powershell"

Linux – Detect Unusual Outbound Connections to GitHub C2:

 Monitor for suspicious GitHub traffic from unexpected processes
sudo tcpdump -i any -1 'host raw.githubusercontent.com and port 443'

Check for recent PowerShell Core (pwsh) activity if installed on Linux
ps aux | grep -i pwsh

Audit cron jobs for unusual PowerShell or curl callbacks
cat /etc/crontab /var/spool/cron/crontabs/ 2>/dev/null | grep -iE "curl|wget|powershell"

3. RAG for Intelligence Gathering: Querying Stolen Documents

Retrieval-Augmented Generation (RAG) is the most concerning capability in Kimsuky’s offline stack. By connecting LLMs to a private document collection via RAG, the group can query stolen intelligence without exposing it to the cloud. The presence of a configured `localdocs_v3.db` database confirms active RAG implementation.

Genians recovered an operator request that exemplifies the group’s objectives: “check a data set for wallet details, Gmail credentials and site-registration history,” ending with the instruction, “The more detailed the analysis, the better. Please do not do it haphazardly.” This reveals a methodical approach to data exploitation—using AI to extract actionable intelligence from vast stores of exfiltrated documents.

Simulating RAG Query Logic (Conceptual Python):

 Illustrative example of how RAG might be used to query stolen documents
import chromadb  Vector database for RAG

Initialize Chroma client
client = chromadb.Client()
collection = client.create_collection(name="stolen_docs")

Add document chunks (simulated)
collection.add(
documents=["Wallet address: 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa", 
"Gmail: [email protected]", 
"Registration history: 2023-01-15"],
ids=["doc1", "doc2", "doc3"]
)

Query for sensitive information
results = collection.query(
query_texts=["wallet credentials gmail"],
n_results=3
)
print(results)

Detection Strategy: Monitor for unusual outbound connections to localhost ports commonly used by LLM runners (e.g., Ollama uses port 11434). EDR solutions should flag processes that spawn LLM-related binaries (ollama, gpt4all, msty) or access RAG database files (.db with RAG signatures).

4. AI-Assisted Malware Development: Cursor and Semantic Kernel

Kimsuky’s collection of AI development frameworks signals a long-term commitment to embedding AI into custom malware. The presence of Microsoft.Semantic.Kernel and Microsoft.Agents.AI—frameworks for building AI agents in C and .NET—suggests the group is developing proprietary tools that leverage LLM capabilities directly within their malware. Cursor, an AI-powered code editor, accelerates the writing and debugging of malicious code.

Potential Attack Scenario: A custom .NET malware binary could use Semantic Kernel to call a local Ollama instance, generating phishing lures dynamically based on the victim’s environment or processing exfiltrated data on the fly. This would make the malware adaptive and harder to signature-detect.

Windows Command to Detect AI Development Frameworks:

 Search for Semantic Kernel or Cursor artifacts
Get-ChildItem -Path C:\ -Recurse -ErrorAction SilentlyContinue | 
Where-Object { $_.Name -match "SemanticKernel|Microsoft.Agents|Cursor" }

Check for .NET assemblies loaded with AI-related namespaces
Get-Process | ForEach-Object { 
try { 
[System.Reflection.Assembly]::LoadFrom($<em>.MainModule.FileName) | 
Where-Object { $</em>.GetTypes().Name -match "Kernel|Agent|LLM" } 
} catch {} 
}

5. Fortifying Defenses Against AI-Enhanced Attacks

With AI eroding traditional phishing indicators—stilted translations, clumsy formatting, and spelling mistakes—defenders must shift their detection paradigm. Genians advises correlating LNK execution, PowerShell activity, hidden scheduled tasks, GitHub traffic, and later payload activity rather than judging a lure solely by its polish.

Recommended Hardening Measures:

  1. Restrict LNK Execution: Use Windows AppLocker or SRP to limit execution of LNK files from user-writable directories.
  2. Monitor PowerShell: Enable Script Block Logging and Module Logging. Forward logs to a SIEM for correlation.
  3. Block Unauthorized GitHub C2: Implement network policies to restrict outbound connections to `raw.githubusercontent.com` and other code-hosting platforms unless explicitly required.

4. EDR Behavioral Rules: Create detection rules for:

  • Processes spawning `powershell.exe` with encoded commands.
  • Scheduled tasks with random or obfuscated names.
  • Outbound connections to GitHub on non-standard ports.
  • Local LLM processes (ollama.exe, gpt4all.exe) on workstations.

Linux Detection Commands:

 Monitor for suspicious process executions
auditctl -a always,exit -F arch=b64 -S execve -k process_monitor

Search for LLM-related binaries
sudo find / -1ame "ollama" -o -1ame "gpt4all" -o -1ame "msty" 2>/dev/null

Check for unexpected Python/Conda environments hosting AI libraries
pip list | grep -iE "langchain|chromadb|transformers|torch"

6. Indicators of Compromise (IoCs) and Threat Hunting

Genians’ report provides concrete IoCs for threat hunters:

| Type | Indicator | Description |

||–|-|

| C2 IP | 112.216.9[.]171 | AsyncRAT C2 address embedded in `fox.png` |
| LNK Artifacts | LNK files with obfuscated command-line args | Embedded PowerShell loaders |
| GitHub Repos | Public repos containing PowerShell scripts and payloads | Abuse as C2 and distribution |
| RAG Database | `localdocs_v3.db` | GPT4All RAG configuration |
| Language Artifacts | “Arirang”, “싸이트”, “가입리력”, “로출되였는지” | North Korean linguistic indicators |

Threat Hunting Query (Splunk/ELK):

index=windows_event_logs EventCode=4104 (PowerShell script block)
| search Message="Base64" OR Message="EncodedCommand"
| stats count by host, user, Message
| where count > 5

What Undercode Say:

  • Key Takeaway 1: Kimsuky’s shift to offline AI is not about building new models but strategically assembling existing open-source tools—Ollama, GPT4All, Msty, RAG, and Cursor—into a cohesive attack pipeline. This lowers the barrier to AI integration while maximizing operational security.

  • Key Takeaway 2: The traditional tell of poorly written phishing emails is rapidly disappearing. AI-generated lures now mimic legitimate business documents with high fidelity, forcing defenders to pivot from content-based detection to behavior-based hunting—focusing on LNK execution, PowerShell activity, and GitHub C2 traffic rather than grammatical errors.

Analysis: This development represents a force multiplier for state-sponsored cyber operations. By running AI locally, Kimsuky can process sensitive stolen intelligence without cloud exposure, generate adaptive phishing content at scale, and accelerate malware development through AI-assisted coding. The group’s collection of Semantic Kernel and Microsoft.Agents.AI libraries suggests future malware may embed LLM capabilities directly, enabling real-time decision-making and dynamic payload generation. For enterprise defenders, the immediate priority is updating detection rules to flag LLM-related processes and GitHub C2 patterns, while reconsidering the efficacy of traditional email filtering that relies on linguistic quality as a threat signal. The Kimsuky case underscores a broader trend: AI is becoming an integral component of the attacker’s toolkit, not just an experimentation novelty.

Expected Output:

Introduction:

North Korea’s Kimsuky hacking group has assembled a proprietary offline AI stack—running local LLMs (Ollama, GPT4All, Msty), RAG pipelines, and AI-assisted coding tools—to automate phishing, accelerate malware development, and analyze exfiltrated data without cloud exposure. This marks a critical escalation: AI-generated lures now erode traditional detection tells, forcing defenders to pivot from content-based to behavior-based hunting.

What Undercode Say:

  • Kimsuky is systematically assembling open-source AI tools into an attack pipeline, not training models from scratch—lowering the barrier to AI integration while maximizing operational security through local execution.
  • Traditional phishing indicators (grammatical errors, awkward phrasing) are disappearing; defenders must now correlate LNK execution, PowerShell activity, and GitHub C2 traffic rather than judging lure quality.

Expected Output:

[The article above fulfills the complete expected output requirement.]

Prediction:

  • -1 Escalation of AI-Enabled Phishing: As Kimsuky refines its RAG pipelines, phishing campaigns will become nearly indistinguishable from legitimate communications, driving a sharp increase in successful initial compromises across government, defense, and financial sectors.
  • -1 Proliferation of Offline AI Stacks: Other state-sponsored and cybercriminal groups will replicate Kimsuky’s model, adopting local LLMs and RAG to evade cloud-based monitoring, making AI-enhanced attacks the new baseline rather than an exception.
  • -1 Malware with Embedded AI Agents: The collection of Semantic Kernel and Microsoft.Agents.AI libraries points toward future malware that dynamically generates lures, processes stolen data, and adapts its behavior using local LLMs—rendering signature-based detection obsolete.
  • +1 Behavioral EDR Maturation: The shift will accelerate adoption of behavior-based detection and EDR solutions that focus on process execution chains, GitHub C2 patterns, and LLM process artifacts, ultimately strengthening enterprise hunting capabilities.
  • -1 Increased Difficulty in Attribution: Offline AI operations reduce the digital exhaust that typically aids attribution, making it harder for defenders and intelligence agencies to trace attacks back to specific threat actors.

🎯Let’s Practice For Free:

🎓 Live Courses & Certifications:

Join Undercode Academy for Verified Certifications

🚀 Request a Custom Project:

Secure, high-velocity infrastructure and disruptive technological engineering. Contact our engineering team for high-tier development and proprietary systems:
[email protected]
💎 Smart Architecture | 🛡️ Secure by Design | ⭐ Trusted by Thousands

IT/Security Reporter URL:

Reported By: https://lnkd.in/p/ev64dXCY – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅

🔐JOIN OUR CYBER WORLD [ CVE News • HackMonitor • UndercodeNews ]

💬 Whatsapp | 💬 Telegram

📢 Follow UndercodeTesting & Stay Tuned:

𝕏 formerly Twitter 🐦 | @ Threads | 🔗 Linkedin | 🦋BlueSky