• Skip to primary navigation
  • Skip to main content
  • Skip to footer
lab52

lab52

The threat intelligence division of S2 Grupo

  • Home
  • Faq
  • Blog
  • About
  • Contact

New tricks of APT29 – update on the CERT.PL report

May 25, 2023

A new sample has been uploaded to VirusTotal, and its characteristics strongly resemble QUARTERRIG, a malware recently analyzed by CERT.PL and linked to APT29. In said analysis, the campaign was named “Note“. Based on the aforementioned report, the purpose of this post is to show the new features of this new campaign that we named “Information“.

The hash of the sample made public in VirusTotal is b422ba73f389ae5ef9411cf4484c840c7c82f2731c6324db0b24b6f87ce8477d, and only 3 antivirus engines target the sample as malicious during the writing of this post.

Sample in VirusTotal analysed in this report

APT29 is a hacker group allegedly affiliated with one or more Russian intelligence agencies. It is a sophisticated group that has been carrying out attacks against European governments and diplomatic agencies since 2008.

The main entry vector for APT29 is email. Using this input vector, attackers attach a PDF with a link that will download an ISO.

New campaign: “Information”

This new campaign, which will be referred to as Information, contains a structure very similar to the Note campaigns shown in the CERT.PL report. The samples analyzed in that report are from March. However, from Lab52, we have observed a change in the operation of this type of malware since April, and in the latest analyzed samples, the injection method has varied. In this post, we use one of the latest samples to highlight the new changes in the mechanisms employed.

This time the file containing the shellcode is located in a file called “dbg.info” unlike what we have been observing in previous campaings. The Information.iso contains:

  • AppvlsSubsystems64.dll – DLL used to load a legitime system DLL and inject the shellcode into it.
  • dbg.info – shellcode.
  • Information .exe – Legitime binary signed by Microsoft. This will be use to load AppvlsSubsystems64.dll (by DLL Side-Load).
Contents of “Information.iso” versus “Note.iso” (past campaign)

The compilation date for AppvIsvSubsystems64.dll in this new campaign is more recent than the previous one. This could suggest that changes were made to improve the sample.

Compilation date AppvIsvSubsystems64.dll – Information

This post focuses on the main diferences between the previous campaing and the new one, in order to contribute to the community. The most noticeable change is the injection technique. Nevertheless some addional notes are added for the curious.

The objective is the same: the executable (Information.exe in this case) will be used to execute two DLLs. The first DLL is AppvlsvSubsystems64.dll, that will be loaded by the process as part of its execution. The second DLL will be loaded by AppvlsvSubsystem64.dll. In this case, however, the second DLL will be carefully modified with different techniques in order to minimize the detection methods.

Therefore, Information.exe, that is a legitime binary, will be the container for the malware to be executed. In order to do that, it will load AppvIsvSubsystems64.dll who needs to identify a suitable system DLL to be modified – with the shellcode – before the load in Information.exe. The main changes are located in AppvIsvSubsystems64.dll. Also, the command and control (C2) varies.

The following diagram describes the infection chain analysed in this post.

Infection chain – Information campaign

Description of the APIs

When running the sample, the first difference lies in how the AppvIsvSubsystems64.dll loads the functions needed for the execution. In the “Note” campaing, the funcions are loaded at an early stage than the Information campaign. Moreover, the decription in this last case occurs at a different point, later in during the execution.

Entry point of AppvIsvSubsystems64.dll – Information vs Note
Differences in .data – Informtion vs Note

Shellcode injection

The way in which the sample injects shellcode into memory also varies from campaign to campaign. As can be seen in the report, “Note” reserves a memory space in its process and writes the shellcode into it.

In this case the injection process is more sophisticated, the injection will be triggered by modifying the .text section of legitimate libraries. The following actions are performed by AppvIsvSubsystems64.dll.

In order to do that, first it goes through each of the DLLs stored in System32.

Next check the size of the DLL, it will only be a candidate if it has a size greater than or equal to 782629 bytes (Shellcode size).

Test DLL size

The sample also checks that the candidate DLL is not already loaded in the executable (Information.exe). That is, the following list are the DLLs already loaded in Information.exe, and, therefore, discarded by the malware:

msvcp140.dllcombase.dll
msi.dllsechost.dll
appvisvsubsystem64.dllmsvcrt.dll
vcruntime140.dllkernel32.dll
vcruntime140_1.dllimm32.dll
ucrtbase.dllgdi32.dll
bcrypt.dllrpcrt4.dll
win32u.dllshell32.dll
msvcp_win.dlladvapi32.dll
kernelbase.dlluser32.dll
gdi32full.dllntdll.dll

After said checks, the malware has a set of candidate DLLs. The DLL selected for injection will vary in each execution, thanks to a randomization function implemented in the sample. A list of candidate DLLs by default – those that satisfy the requirements needed by the malware – in Windows 10 64b is provided at the end of this post. This may vary depending on the operating system. However, following the steps in this post is not difficult to prepare your own script. A similar technique is described in the Netero1010 post.

The malware selects the DLL used for the injection as follows.

First, it uses the system time as a seed to apply a series of arithmetic operations on it. The result will be the seed of the next DLL to be checked.

Seed generation using system time

Interestingly, the values it uses for multiplication and addition are identical to those provided in a “Holiday Hack Challenge 2019” challenge organized by SANS. In particular, in the challenge there is a function called “super_secure_random” that performs the same operations with the same operands to a seed (“state”).

Comparison of the CTF algorithm (left) with the sample (right)

Finally, it checks if this resulting number is a multiple of 25 and if it is, it continues with the injection.

Choice of random DLL

Once the DLL has been chosen, the sample accesses the library with CreateFileW (in the execution used to take the pictures for this example the DLL selected was “AppContracts.dll”).

DLL opened

At this point, the sample reads the headers of the libraries to pass a round of checks again. First, look at the “Magic” value to verify that it is a 64-bit system DLL (PE64).

Magic value of the DLL candidate

Another comprobation is to check the “SizeOfImage” field, which refers to the size to reserve in memory to load the executable. If it is less than 782629 bytes (shellcode size), it is discarded.

SizeOfCode of the candidate DLL

Finally, the sample checks the size of the “.text” section (where the shellcode will be injected) and verifies that it is larger than 782629 bytes.

Size of “.text” section of the candidate DLL

Unfortunately, at this point AppContracts.dll (the DLL selected in this execution) does not meet the injection requirements, and the search for the next optimal DLL is AppxPackaging.dll, in this example.

After this screening, the malware will have about 283 candidates for injection in the system used. At the end of the post you will find a table with the possible DLLs in which the malware could be injected, consiering the size required for the injection by this sample (782629) and the system where it be executed.

At this point, the chosen DLL (in this example, at this moment, AppxPackaging.dll) is ready to receive the shellcode, using the following injection method.

Step1. Subsequently, it makes a call to NtCreateSection to create a memory section in the process.

Create section to map the DLL

Step2. And map the library in that section with ZwMapViewOfSection.

Map the DLL

Step3. Once the library is mapped in memory, the write permissions are modified to be able to write the shellcode in it. The address pointed to by VirtualProtect corresponds to the “.text” section of the DLL.

Change protection to RW (.text section)

Step4. After that, write the shellcode in the “.text” section.

Write the shellcode in the .text section. Left: not infected. Right: infected

Step5. Finally the malware changes the permissions of the “.text” section back to “EXECUTABLE_READ” again.

Change the .text section back to RX

Once the shellcode is loaded, the execution is identical to what can be seen in the QUARTERRIG report of CERT.PL, but with a different C2. In this case, the actors use the URL hxxps:]]//pizzais.com/order.php.

Timeline

As mentioned before, Lab52 has observed the evolution in techniques since April. Specifically, here we provide an additional hash of a different file published on VirusTotal that uses this injection technique, found during the writing of this post.

HashDescriptionDate
C71EC48A59631BFA3F33383C1F25719E95E5A80936D913AB3BFE2FEB172C1C5ENotes.iso injecting the shellcode in the .txt section of the DLL28/04/2023

Therefore, at the least in a previous registered case, the .iso file still bears the name “Note.iso,” which could indicate that the new technique was already in use in some samples of the previous campaign. However, the most recent observations show a change in their name to “Information”.

Short timeline – Changes in the injection technique

Conclusions

Just as QUARTERRIG was the evolution of HALFRIG, in this new campaign APT29 has modified the logic of its dll loader “Applvsubsystem64.dll” to make it more sophisticated.

The fact of using legitimate random DLLs for injection instead of the process memory itself, adds another layer of complexity to the way the shellcode is loaded.

A list of system candidates to be injected is provided in this post. However, it must be considered carefully because these are extracted of a specific system, following the previous steps. The analysts can follow the steps mentioned here in order to build their own script to get the list of DLL candidates to be used by the authors this new campaing.

Indicators of Compromise (IOC)


File
Hash
Information.isoB422BA73F389AE5EF9411CF4484C840C7C82F2731C6324DB0B24B6F87CE8477D
Information .exe6C55195F025FB895F9D0EC3EDBF58BC0AA46C43EEB246CFB88EEF1AE051171B3
AppvIsvSubsystems64.dllE7C49758BAE63C83D251CACBFADA7C09AF0C3038E8FF755C4C04F916385805D8
dbg.info5F6219ADE8E0577545B9F13AFD28F6D6E991326F3C427D671D1C1765164B0D57
C2
hxxps:]]//pizzais.com/order.php
FilesystemDescription
C:\Users\user\AppData\Local\MSOfficeUpdate\AppvIsvSubsystems64.dll, Information .exe, dbg.info
PersistenceValue
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\RunC:\Users\user\AppData\Local\MSOfficeUpdate\Information .exe

Candidate system DLLs for injection

The following DLLs will pass the checks for this sample (size and other requirements). This list may vary on the target system depending on the version and the system software installed. Please check.

aadtb.dllActiveSyncProvider.dlladtschema.dll
APMon.dllappraiser.dllAppXDeploymentExtensions.desktop.dll
AppXDeploymentExtensions.onecore.dllAppXDeploymentServer.dllAppxPackaging.dll
AudioEng.dllAudioSes.dllaudiosrv.dll
AuthFWSnapin.dllAuthFWSnapIn.Resources.dllAzureSettingSyncProvider.dll
bcastdvruserservice.dllBingMaps.dllcavo2gui.dll
cdp.dllcdprt.dllCertEnroll.dll
Chakra.dllcimwin32.dllClipSVC.dll
CloudExperienceHostCommon.dllcmiv2.dllcomsvcs.dll
ConstraintIndex.Search.dllContentDeliveryManager.Utilities.dllCoreShell.dll
CoreUIComponents.dllcrypt32.dlld2d1.dll
d3d10.dlld3d10warp.dlld3d11.dll
D3D12Core.dlld3d9.dllD3DCompiler_47.dll
dbgeng.dlldbghelp.dlldcomp.dll
DeviceFlows.DataModel.dlldfshim.dlldiagperf.dll
diagtrack.dlldirectml.dllDMWmiBridgeProv.dll
dosvc.dlldrvstore.dlldui70.dll
dwmcore.dlldwmscene.dllDWrite.dll
dxilconv.dlledgeangle.dllEdgeContent.dll
edgehtml.dllefscore.dllEmailApis.dll
enterprisecsps.dllesent.dllExplorerFrame.dll
FaceProcessor.dllFaceRecognitionEngineAdapter.dllfhuxpresentation.dll
FluencyDS.dllFntCache.dllFrameServer.dll
GdiPlus.dllgpsvc.dllHologramWorld.dll
Hydrogen.dllicu.dllieframe.dll
inetcomm.dllInputHost.dllInputService.dll
InstallService.dllIntelWifiIhv08.dllISM.dll
jscript9.dllkerberos.dllKernelBase.dll
libcrypto.dlllocalspl.dllLocationFramework.dll
lpasvc.dlllsasrv.dllMapGeocoder.dll
MapRouter.dllMCRecvSrc.dllMdmDiagnostics.dll
MemoryAnalyzer.dllMessagingDataModel2.dllmfasfsrcsnk.dll
mfc140.dllmfc140u.dllmfc42.dll
mfc42u.dllmfcore.dllMFMediaEngine.dll
mfmkvsrcsnk.dllmfmp4srcsnk.dllmfmpeg2srcsnk.dll
mfnetcore.dllmfnetsrc.dllmfperfhelper.dll
mfplat.dllmfreadwrite.dllmfsrcsnk.dll
mfsvr.dllMicrosoft.Bluetooth.Service.dllMicrosoft.Graphics.Display.DisplayEnhancementService.dll
migcore.dllMiracastReceiver.dllmispace.dll
mmcndmgr.dllmmgaclient.dllMSAJApi.dll
msctf.dllmsdtctm.dllmsftedit.dll
mshtml.dllmsmpeg2vdec.dllMSPhotography.dll
mssrch.dllmstscax.dllMSTTSEngine_OneCore.dll
MSVidCtl.dllmsvproc.dllmsxml3.dll
msxml6.dllMSxpsPCL6.dllMSxpsPS.dll
mxdwdrv.dllNetworkMobileSettings.dllNotificationController.dll
ole32.dllOpcServices.dllopengl32.dll
PCPKsp.dllperf_nt.dllpidgenx.dll
pla.dllPresentationNative_v0300.dllPrintConfig.dll
PrintConfig.dllPrintConfig.dllPrintConfig.dll
qmgr.dllquartz.dllrasapi32.dll
rasmans.dllrdpbase.dllrdpcore.dll
rdpcorets.dllrdpnano.dllrdpserverbase.dll
rdpsharercom.dllreseteng.dllResetEngine.dll
RP2DSN32.dllrpcss.dllrtmcodecs.dll
rtmpal.dllrtmpltfm.dllsapi.dll
sapi_onecore.dllsbe.dllsdengin2.dll
SettingsHandlers_nt.dllsetupapi.dllSpeechPal.dll
sppobjs.dllspsreng.dllspsreng_onecore.dll
spwizimg.dllSRH.dllStartTileData.dll
storagewmi.dllsysmain.dllSystemSettings.Handlers.dll
SystemSettingsThresholdAdminFlowUI.dllTaskFlowDataEngine.dlltermsrv.dll
TextInputMethodFormatter.dllTokenBroker.dllTpmCoreProvisioning.dll
tquery.dlltsf3gip.dlltwinapi.appcore.dll
twinui.dlltwinui.pcshell.dlluDWM.dll
UIAutomationCore.dllUIRibbon.dllUIRibbonRes.dll
Unistore.dllUpdateAgent.dllurlmon.dll
usbmon.dllUserDataService.dllusermgr.dll
VBoxDispD3D.dllVBoxDispD3D.dllVBoxGL.dll
VBoxGL.dllVBoxGL-x86.dllVBoxMRXNP.dll
VBoxNine.dllVBoxNine.dllVBoxSVGA.dll
VBoxSVGA.dllVBoxSVGA-x86.dllvo28gui.dll
vssapi.dllwbemcore.dllwebplatstorageserver.dll
WebRuntimeManager.dllwebservices.dllwevtsvc.dll
win32spl.dllWindowManagement.dllWindows.AI.MachineLearning.dll
Windows.ApplicationModel.Store.dllWindows.CloudStore.dllWindowsCodecs.dll
WindowsCodecsRaw.dllWindows.Data.Pdf.dllWindows.Devices.Bluetooth.dll
Windows.Devices.Perception.dllWindows.Devices.PointOfService.dllWindows.Globalization.dll
Windows.Graphics.Printing.3D.dllWindows.Graphics.Printing.Workflow.dllWindows.Internal.Signals.dll
WindowsInternal.Xaml.Controls.Tabs.dllWindows.Media.dllWindows.Media.Editing.dll
Windows.Media.Protection.PlayReady.dllWindows.Media.Speech.dllWindows.Media.Streaming.dll
Windows.Mirage.dllWindows.Networking.BackgroundTransfer.dllWindows.Security.Authentication.Web.Core.dll
Windows.StateRepository.dllwindows.storage.dllwindowsudk.shellcommon.dll
Windows.UI.Cred.dllWindows.UI.Immersive.dllWindows.UI.Input.Inking.Analysis.dll
Windows.UI.Input.Inking.dllWindows.UI.Logon.dllWindows.UI.Shell.Internal.AdaptiveCards.dll
Windows.UI.Xaml.Controls.dllWindows.UI.Xaml.dllWindows.UI.Xaml.Maps.dll
Windows.UI.Xaml.Phone.dllWindows.Web.Http.dllwinhttp.dll
wininet.dllwinmde.dllwinmsipc.dll
winsetup.dllwlansvc.dllwlidsvc.dll
WMNetMgr.dllwmp.dllworkfolderssvc.dll
WpcDesktopMonSvc.dllWpc.dllwpncore.dll
WsmSvc.dllwsp_fs.dllwsp_health.dll
wuaueng.dllwwansvc.dllXblAuthManager.dll
XblGameSave.dllXboxNetApiSvc.dllXpsPrint.dll
xpsservices.dll

Er1c_C

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Related

New invitation from APT29 to use CCleaner
July 12, 2023
Tags: APT29, CCleaner, DLLSide-Load, phishing, Russia, SVG
DLL Side Loading through IObit against Colombia
May 28, 2024
Tags: AsyncRAT, Colombia
Pelmeni Wrapper: New Wrapper of Kazuar (Turla Backdoor)
February 19, 2024
Tags: Backdoor, Kazuar, Pelmeni Wrapper, Trula, Wrapper

Footer

Copyright &copy Lab52 2019 by S2 Grupo | Legal notice | Cookie policy | Privacy policy