Resubmissions

23-03-2023 18:08

230323-wrdjxsbc7t 10

23-03-2023 17:40

230323-v81kcahb95 7

General

  • Target

    prtg_installer.exe

  • Size

    341.9MB

  • Sample

    230323-wrdjxsbc7t

  • MD5

    3de61701ed11fc334ac81974a8151095

  • SHA1

    49cf1f4eb4fbde4388470b6ea8cf1fc0cb67889e

  • SHA256

    0dd1952b8ee8a56f77fba968366794bfa58abefc38151192d378eaf35607091f

  • SHA512

    b2a8d03585bcd1227f3a163d87f38c406722076709a7208eeb61e86fab5181e80230a538f37efb3786c5b1e475e10b7528d071aef8667f1aca0fab3564b0b63a

  • SSDEEP

    6291456:Komt7yD6gwdY0I2pUQKwFXfh9lAzooK+AwoEbt2iO/XhArMqs:dmtI6gwu0I2SXOh9lAzVAWERhGM

Malware Config

Extracted

Path

C:\Windows\Temp\is-103IS.tmp\probe\{app}\python\Lib\site-packages\Crypto\Cipher\__pycache__\is-S97GH.tmp

Ransom Note
a �������bv8����������������������@���s����d�Z�dgZddlmZmZ�ddlmZmZ�ddlm Z �ddl m Z m Z �ddl mZ�ddlmZ�dd lmZ�G�d d��de�Zd d ��Zd S�)z- Synthetic Initialization Vector (SIV) mode. �SivMode�����)�hexlify� unhexlify)�bord� _copy_bytes)� is_buffer)� long_to_bytes� bytes_to_long)�_S2V)�BLAKE2s)�get_random_bytesc�������������������@���sl���e�Zd�ZdZdd��Zdd��Zdd��Zdd ��Zd d ��Zd d ��Z dd��Z dd��Z dd��Z ddd�Z ddd�ZdS�)r���a���Synthetic Initialization Vector (SIV). This is an Authenticated Encryption with Associated Data (`AEAD`_) mode. It provides both confidentiality and authenticity. The header of the message may be left in the clear, if needed, and it will still be subject to authentication. The decryption step tells the receiver if the message comes from a source that really knowns the secret key. Additionally, decryption detects if any part of the message - including the header - has been modified or corrupted. Unlike other AEAD modes such as CCM, EAX or GCM, accidental reuse of a nonce is not catastrophic for the confidentiality of the message. The only effect is that an attacker can tell when the same plaintext (and same associated data) is protected with the same key. The length of the MAC is fixed to the block size of the underlying cipher. The key size is twice the length of the key of the underlying cipher. This mode is only available for AES ciphers. +--------------------+---------------+-------------------+ | Cipher | SIV MAC size | SIV key length | | | (bytes) | (bytes) | +====================+===============+===================+ | AES-128 | 16 | 32 | +--------------------+---------------+-------------------+ | AES-192 | 16 | 48 | +--------------------+---------------+-------------------+ | AES-256 | 16 | 64 | +--------------------+---------------+-------------------+ See `RFC5297`_ and the `original paper`__. .. _RFC5297: https://tools.ietf.org/html/rfc5297 .. _AEAD: http://blog.cryptographyengineering.com/2012/05/how-to-choose-authenticated-encryption.html .. __: http://www.cs.ucdavis.edu/~rogaway/papers/keywrap.pdf :undocumented: __init__ c�����������������C���s����|j�|�_�||�_||�_t|�dvr0tdt|����|d�urjt|�sHtd��t|�dkr\td��td�d�|�|�_t|�d�}d�|�_ t |d�|��||�jd�|�_ ||d���|�_ |j |d�|��|jfi�|���|�j|�j|�j|�j|�jg|�_d�S�)N)� ����0����@���zIncorrect key length (%d bytes)z?When provided, the nonce must be bytes, bytearray or memoryviewr���z*When provided, the nonce must be non-empty����)Z ciphermodZ cipher_params)� block_size�_factory�_cipher_params�len� ValueErrorr���� TypeErrorr����nonce�_mac_tagr ����_kdf�_subkey_cipher�newZMODE_ECB�update�encrypt�decrypt�digest�verify�_next)�self�factory�keyr����kwargsZ subkey_size��r&����[C:\builds\3rdparty\bash-packages\.build\python\Lib\site-packages\Crypto/Cipher/_mode_siv.py�__init__[���s,����    � �zSivMode.__init__c�����������������C���s4���t�|�}|d@�}|�jj|�j|�jjf|dd�|�j��S�)z*Create a new CTR cipher from V in SIV model ������������������)� initial_valuer���)r ���r���r���r���ZMODE_CTRr���)r"����vZv_int�qr&���r&���r'����_create_ctr_cipher����s�������zSivMode._create_ctr_cipherc�����������������C���s:���|�j�|�jvrtd��|�j�|�j|�j|�j|�jg|�_|�j��|�S�)a���Protect one associated data component For SIV, the associated data is a sequence (*vector*) of non-empty byte strings (*components*). This method consumes the next component. It must be called once for each of the components that constitue the associated data. Note that the components have clear boundaries, so that: >>> cipher.update(b"builtin") >>> cipher.update(b"securely") is not equivalent to: >>> cipher.update(b"built") >>> cipher.update(b"insecurely") If there is no associated data, this method must not be called. :Parameters: component : bytes/bytearray/memoryview The next associated data component. z<update() can only be called immediately after initialization)r���r!���r���r���r���r���r ���r���)r"���� componentr&���r&���r'���r�������s ����  �zSivMode.updatec�����������������C���s ���t�d��dS�)z� For SIV, encryption and MAC authentication must take place at the same point. This method shall not be used. Use `encrypt_and_digest` instead. zEencrypt() not allowed for SIV mode. Use encrypt_and_digest() instead.N�r���)r"���� plaintextr&���r&���r'���r�������s����zSivMode.encryptc�����������������C���s ���t�d��dS�)z� For SIV, decryption and verification must take place at the same point. This method shall not be used. Use `decrypt_and_verify` instead. zEdecrypt() not allowed for SIV mode. Use decrypt_and_verify() instead.Nr/���)r"���� ciphertextr&���r&���r'���r�������s����zSivMode.decryptc�����������������C���s:���|�j�|�jvrtd��|�j�g|�_|�jdu�r4|�j���|�_|�jS�)z�Compute the *binary* MAC tag. The caller invokes this function at the very end. This method returns the MAC that shall be sent to the receiver, together with the ciphertext. :Return: the MAC, as a byte string. zAdigest() cannot be called when decrypting or validating a messageN)r���r!���r���r���r����derive�r"���r&���r&���r'���r�������s ����    zSivMode.digestc�����������������C���s���d��dd��|����D���S�)z�Compute the *printable* MAC tag. This method is like `digest`. :Return: the MAC, as a hexadecimal string. ��c�����������������S���s���g�|�]}d�t�|���qS�)z%02x)r���)�.0�xr&���r&���r'���� <listcomp>����r)���z%SivMode.hexdigest.<locals>.<listcomp>)�joinr���r3���r&���r&���r'���� hexdigest����s����zSivMode.hexdigestc�����������������C���sz���|�j�|�jvrtd��|�j�g|�_|�jdu�r4|�j���|�_td�}tjd||�jd�}tjd||d�}|� ��|� ��krvt d��dS�)a(��Validate the *binary* MAC tag. The caller invokes this function at the very end. This method checks if the decrypted message is indeed valid (that is, if the key is correct) and it has not been tampered with while in transit. :Parameters: received_mac_tag : bytes/bytearray/memoryview This is the *binary* MAC, as received from the sender. :Raises ValueError: if the MAC does not match. The message has been tampered with or the key is incorrect. z3verify() cannot be called when encrypting a messageN���������)Z digest_bitsr$����datazMAC check failed) r ���r!���r���r���r���r2���r ���r ���r���r���r���)r"���Zreceived_mac_tag�secretZmac1Zmac2r&���r&���r'���r �������s����    zSivMode.verifyc�����������������C���s���|���t|���dS�)aW��Validate the *printable* MAC tag. This method is like `verify`. :Parameters: hex_mac_tag : string This is the *printable* MAC, as received from the sender. :Raises ValueError: if the MAC does not match. The message has been tampered with or the key is incorrect. N)r ���r���)r"���Z hex_mac_tagr&���r&���r'���� hexverify��s���� zSivMode.hexverifyNc�����������������C���sn���|�j�|�jvrtd��|�jg|�_t|�d�r6|�j�|�j��|�j�|��|�j���|�_ |�� |�j �}|j�||d�|�j fS�)a\��Perform encrypt() and digest() in one step. :Parameters: plaintext : bytes/bytearray/memoryview The piece of data to encrypt. :Keywords: output : bytearray/memoryview The location where the ciphertext must be written to. If ``None``, the ciphertext is returned. :Return: a tuple with two items: - the ciphertext, as ``bytes`` - the MAC tag, as ``bytes`` The first item becomes ``None`` when the ``output`` parameter specified a location for the result. z@encrypt() can only be called after initialization or an update()r�����output) r���r!���r���r����hasattrr���r���r���r2���r���r-���)r"���r0���r@����cipherr&���r&���r'����encrypt_and_digest��s����      zSivMode.encrypt_and_digestc�����������������C���sx���|�j�|�jvrtd��|�jg|�_|��|�|�_|�jj�||d�}t|�d�rR|�j�|�j ��|�j�|du�rd|n|��|��|��|S�)aP��Perform decryption and verification in one step. A cipher object is stateful: once you have decrypted a message you cannot decrypt (or encrypt) another message with the same object. You cannot reuse an object for encrypting or decrypting other data with the same key. This function does not remove any padding from the plaintext. :Parameters: ciphertext : bytes/bytearray/memoryview The piece of data to decrypt. It can be of any length. mac_tag : bytes/bytearray/memoryview This is the *binary* MAC, as received from the sender. :Keywords: output : bytearray/memoryview The location where the plaintext must be written to. If ``None``, the plaintext is returned. :Return: the plaintext as ``bytes`` or ``None`` when the ``output`` parameter specified a location for the result. :Raises ValueError: if the MAC does not match. The message has been tampered with or the key is incorrect. z@decrypt() can only be called after initialization or an update()r?���r���N) r���r!���r���r ���r-���Z_cipherrA���r���r���r���)r"���r1���Zmac_tagr@���r0���r&���r&���r'����decrypt_and_verify6��s����     zSivMode.decrypt_and_verify)N)N)�__name__� __module__� __qualname__�__doc__r(���r-���r���r���r���r���r9���r ���r>���rC���rD���r&���r&���r&���r'���r���1���s���)& #   ! $c�������������� ���K���s^���z|��d�}W�n4�tyB�}�ztdt|����W�Y�d}~n d}~0�0�|��dd�}t|�|||�S�)a-��Create a new block cipher, configured in Synthetic Initializaton Vector (SIV) mode. :Parameters: factory : object A symmetric cipher module from `Crypto.Cipher` (like `Crypto.Cipher.AES`). :Keywords: key : bytes/bytearray/memoryview The secret key to use in the symmetric cipher. It must be 32, 48 or 64 bytes long. If AES is the chosen cipher, the variants *AES-128*, *AES-192* and or *AES-256* will be used internally. nonce : bytes/bytearray/memoryview For deterministic encryption, it is not present. Otherwise, it is a value that must never be reused for encrypting message under this key. There are no restrictions on its length, but it is recommended to use at least 16 bytes. r$���zMissing parameter: Nr���)�pop�KeyErrorr����strr���)r#���r%���r$����er���r&���r&���r'����_create_siv_ciphere��s ����& rM���N)rH����__all__�binasciir���r���ZCrypto.Util.py3compatr���r���ZCrypto.Util._raw_apir���ZCrypto.Util.numberr���r ���ZCrypto.Protocol.KDFr ���Z Crypto.Hashr ���Z Crypto.Randomr ����objectr���rM���r&���r&���r&���r'����<module>���s���    ��6
URLs

https://tools.ietf.org/html/rfc5297

http://blog.cryptographyengineering.com/2012/05/how-to-choose-authenticated-encryption.html

http://www.cs.ucdavis.edu/~rogaway/papers/keywrap.pdf

Extracted

Path

C:\Windows\Temp\is-103IS.tmp\probe\{app}\python\Lib\site-packages\Crypto\Cipher\__pycache__\is-4QLSI.tmp

Ransom Note
a �������bj#����������������������@���st���d�dl�mZ�d�dlZd�dlmZmZ�d�dlZd�dlmZm Z m Z �d�dl m Z �d�dlm Z �G�dd��d�Zd d d �ZdS�) �����)�MGF1N)�bord� _copy_bytes)�ceil_div� bytes_to_long� long_to_bytes)�strxor)�Randomc�������������������@���s8���e�Zd�ZdZdd��Zdd��Zdd��Zdd ��Zd d ��Zd S�) �PKCS1OAEP_CipherzXCipher object for PKCS#1 v1.5 OAEP. Do not create directly: use :func:`new` instead.c��������������������sN���|��_�|r|��_n tjj��_|r(|��_n��fdd���_tdd|���_|��_dS�)a��Initialize this PKCS#1 OAEP cipher object. :Parameters: key : an RSA key object If a private half is given, both encryption and decryption are possible. If a public half is given, only encryption is possible. hashAlgo : hash object The hash function to use. This can be a module under `Crypto.Hash` or an existing hash object created from any of such modules. If not specified, `Crypto.Hash.SHA1` is used. mgfunc : callable A mask generation function that accepts two parameters: a string to use as seed, and the lenth of the mask to generate, in bytes. If not specified, the standard MGF1 consistent with ``hashAlgo`` is used (a safe choice). label : bytes/bytearray/memoryview A label to apply to this particular encryption. If not specified, an empty string is used. Specifying a label does not improve security. randfunc : callable A function that returns random bytes. :attention: Modify the mask generation function only if you know what you are doing. Sender and receiver must use the same one. c��������������������s���t�|�|��j�S�)N)r����_hashObj)�x�y��self���\C:\builds\3rdparty\bash-packages\.build\python\Lib\site-packages\Crypto/Cipher/PKCS1_OAEP.py�<lambda>G��������z+PKCS1OAEP_Cipher.__init__.<locals>.<lambda>N) �_keyr ����CryptoZHash�SHA1�_mgfr����_label� _randfunc)r����key�hashAlgo�mgfunc�label�randfuncr���r���r����__init__$���s���� zPKCS1OAEP_Cipher.__init__c�����������������C���s ���|�j����S�)zVLegacy function to check if you can call :meth:`encrypt`. .. deprecated:: 3.0)r���� can_encryptr���r���r���r���r ���L���s����zPKCS1OAEP_Cipher.can_encryptc�����������������C���s ���|�j����S�)zVLegacy function to check if you can call :meth:`decrypt`. .. deprecated:: 3.0)r���� can_decryptr���r���r���r���r!���R���s����zPKCS1OAEP_Cipher.can_decryptc�����������������C���s����t�jj�|�jj�}t|d�}|�jj}t |�}||�d|��d�}|dk�rPt d��|�j� |�j �� ��}d|�}||�d�tdd|��} |��|�} |��| ||�d��} t| | �} |��| |�} t| | �}d|�| �}t|�}|�j�|�}t||�}|S�) a\��Encrypt a message with PKCS#1 OAEP. :param message: The message to encrypt, also known as plaintext. It can be of variable length, but not longer than the RSA modulus (in bytes) minus 2, minus twice the hash output size. For instance, if you use RSA 2048 and SHA-256, the longest message you can encrypt is 190 byte long. :type message: bytes/bytearray/memoryview :returns: The ciphertext, as large as the RSA modulus. :rtype: bytes :raises ValueError: if the message is too long. ��������r���zPlaintext is too long.���������N����)r����Util�number�sizer����nr���r ���� digest_size�len� ValueError�newr����digestr���r���r���r���r���Z_encryptr���)r����message�modBits�k�hLenZmLenZps_len�lHashZps�dbZros�dbMask�maskedDB�seedMask� maskedSeed�emZem_int�m_int�cr���r���r����encryptX���s(����        zPKCS1OAEP_Cipher.encryptc�����������������C���sj��t�jj�|�jj�}t|d�}|�jj}t |�|ks<||d�k�rDt d��t |�}|�j� |�}t ||�}|�j�|�j����}|d�} |d|d���} ||d�d��} |��| |�} t| | �} |��| ||�d��}t| |�}|||d���d��}|d|��}t| �t||k��B�}t||�}|D�]}|t|�O�}�q|||��D�]}|t|�O�}�q4|dk�rZt d��||d�d��S�) a5��Decrypt a message with PKCS#1 OAEP. :param ciphertext: The encrypted message. :type ciphertext: bytes/bytearray/memoryview :returns: The original message (plaintext). :rtype: bytes :raises ValueError: if the ciphertext has the wrong length, or if decryption fails the integrity check (in which case, the decryption key is probably wrong). :raises TypeError: if the RSA key has no private half (i.e. you are trying to decrypt using a public key). r"���r#���z!Ciphertext with incorrect length.r���r&���Nr%���zIncorrect decryption.)r���r'���r(���r)���r���r*���r���r ���r+���r,���r-���r���Z_decryptr���r.���r���r/���r���r����findr����int)r���Z ciphertextr1���r2���r3���Zct_intr;���r:���r4���r ���r9���r7���r8����seedr6���r5���Zone_posZlHash1�invalidZ hash_comparer ���r���r���r����decrypt����s6����         zPKCS1OAEP_Cipher.decryptN) �__name__� __module__� __qualname__�__doc__r���r ���r!���r=���rB���r���r���r���r���r ��� ���s ���(6r ���r���c�����������������C���s���|du�rt�j}t|�||||�S�)a���Return a cipher object :class:`PKCS1OAEP_Cipher` that can be used to perform PKCS#1 OAEP encryption or decryption. :param key: The key object to use to encrypt or decrypt the message. Decryption is only possible with a private RSA key. :type key: RSA key object :param hashAlgo: The hash function to use. This can be a module under `Crypto.Hash` or an existing hash object created from any of such modules. If not specified, `Crypto.Hash.SHA1` is used. :type hashAlgo: hash object :param mgfunc: A mask generation function that accepts two parameters: a string to use as seed, and the lenth of the mask to generate, in bytes. If not specified, the standard MGF1 consistent with ``hashAlgo`` is used (a safe choice). :type mgfunc: callable :param label: A label to apply to this particular encryption. If not specified, an empty string is used. Specifying a label does not improve security. :type label: bytes/bytearray/memoryview :param randfunc: A function that returns random bytes. The default is `Random.get_random_bytes`. :type randfunc: callable N)r ���Zget_random_bytesr ���)r���r���r���r���r���r���r���r���r.�������s���� r.���)NNr���N)ZCrypto.Signature.pssr���ZCrypto.Hash.SHA1r���ZCrypto.Util.py3compatr���r���ZCrypto.Util.numberr���r���r���ZCrypto.Util.strxorr���r ���r ���r.���r���r���r���r����<module>���s���   �-

Extracted

Path

C:\Windows\Temp\is-103IS.tmp\probe\{app}\python\Lib\site-packages\Crypto\Cipher\is-4L0VT.tmp

Ransom Note
# =================================================================== # # Copyright (c) 2014, Legrandin <helderijs@gmail.com> # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in # the documentation and/or other materials provided with the # distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # =================================================================== """ Synthetic Initialization Vector (SIV) mode. """ __all__ = ['SivMode'] from binascii import hexlify, unhexlify from Crypto.Util.py3compat import bord, _copy_bytes from Crypto.Util._raw_api import is_buffer from Crypto.Util.number import long_to_bytes, bytes_to_long from Crypto.Protocol.KDF import _S2V from Crypto.Hash import BLAKE2s from Crypto.Random import get_random_bytes class SivMode(object): """Synthetic Initialization Vector (SIV). This is an Authenticated Encryption with Associated Data (`AEAD`_) mode. It provides both confidentiality and authenticity. The header of the message may be left in the clear, if needed, and it will still be subject to authentication. The decryption step tells the receiver if the message comes from a source that really knowns the secret key. Additionally, decryption detects if any part of the message - including the header - has been modified or corrupted. Unlike other AEAD modes such as CCM, EAX or GCM, accidental reuse of a nonce is not catastrophic for the confidentiality of the message. The only effect is that an attacker can tell when the same plaintext (and same associated data) is protected with the same key. The length of the MAC is fixed to the block size of the underlying cipher. The key size is twice the length of the key of the underlying cipher. This mode is only available for AES ciphers. +--------------------+---------------+-------------------+ | Cipher | SIV MAC size | SIV key length | | | (bytes) | (bytes) | +====================+===============+===================+ | AES-128 | 16 | 32 | +--------------------+---------------+-------------------+ | AES-192 | 16 | 48 | +--------------------+---------------+-------------------+ | AES-256 | 16 | 64 | +--------------------+---------------+-------------------+ See `RFC5297`_ and the `original paper`__. .. _RFC5297: https://tools.ietf.org/html/rfc5297 .. _AEAD: http://blog.cryptographyengineering.com/2012/05/how-to-choose-authenticated-encryption.html .. __: http://www.cs.ucdavis.edu/~rogaway/papers/keywrap.pdf :undocumented: __init__ """ def __init__(self, factory, key, nonce, kwargs): self.block_size = factory.block_size """The block size of the underlying cipher, in bytes.""" self._factory = factory self._cipher_params = kwargs if len(key) not in (32, 48, 64): raise ValueError("Incorrect key length (%d bytes)" % len(key)) if nonce is not None: if not is_buffer(nonce): raise TypeError("When provided, the nonce must be bytes, bytearray or memoryview") if len(nonce) == 0: raise ValueError("When provided, the nonce must be non-empty") self.nonce = _copy_bytes(None, None, nonce) """Public attribute is only available in case of non-deterministic encryption.""" subkey_size = len(key) // 2 self._mac_tag = None # Cache for MAC tag self._kdf = _S2V(key[:subkey_size], ciphermod=factory, cipher_params=self._cipher_params) self._subkey_cipher = key[subkey_size:] # Purely for the purpose of verifying that cipher_params are OK factory.new(key[:subkey_size], factory.MODE_ECB, **kwargs) # Allowed transitions after initialization self._next = [self.update, self.encrypt, self.decrypt, self.digest, self.verify] def _create_ctr_cipher(self, v): """Create a new CTR cipher from V in SIV mode""" v_int = bytes_to_long(v) q = v_int & 0xFFFFFFFFFFFFFFFF7FFFFFFF7FFFFFFF return self._factory.new( self._subkey_cipher, self._factory.MODE_CTR, initial_value=q, nonce=b"", **self._cipher_params) def update(self, component): """Protect one associated data component For SIV, the associated data is a sequence (*vector*) of non-empty byte strings (*components*). This method consumes the next component. It must be called once for each of the components that constitue the associated data. Note that the components have clear boundaries, so that: >>> cipher.update(b"builtin") >>> cipher.update(b"securely") is not equivalent to: >>> cipher.update(b"built") >>> cipher.update(b"insecurely") If there is no associated data, this method must not be called. :Parameters: component : bytes/bytearray/memoryview The next associated data component. """ if self.update not in self._next: raise TypeError("update() can only be called" " immediately after initialization") self._next = [self.update, self.encrypt, self.decrypt, self.digest, self.verify] return self._kdf.update(component) def encrypt(self, plaintext): """ For SIV, encryption and MAC authentication must take place at the same point. This method shall not be used. Use `encrypt_and_digest` instead. """ raise TypeError("encrypt() not allowed for SIV mode." " Use encrypt_and_digest() instead.") def decrypt(self, ciphertext): """ For SIV, decryption and verification must take place at the same point. This method shall not be used. Use `decrypt_and_verify` instead. """ raise TypeError("decrypt() not allowed for SIV mode." " Use decrypt_and_verify() instead.") def digest(self): """Compute the *binary* MAC tag. The caller invokes this function at the very end. This method returns the MAC that shall be sent to the receiver, together with the ciphertext. :Return: the MAC, as a byte string. """ if self.digest not in self._next: raise TypeError("digest() cannot be called when decrypting" " or validating a message") self._next = [self.digest] if self._mac_tag is None: self._mac_tag = self._kdf.derive() return self._mac_tag def hexdigest(self): """Compute the *printable* MAC tag. This method is like `digest`. :Return: the MAC, as a hexadecimal string. """ return "".join(["%02x" % bord(x) for x in self.digest()]) def verify(self, received_mac_tag): """Validate the *binary* MAC tag. The caller invokes this function at the very end. This method checks if the decrypted message is indeed valid (that is, if the key is correct) and it has not been tampered with while in transit. :Parameters: received_mac_tag : bytes/bytearray/memoryview This is the *binary* MAC, as received from the sender. :Raises ValueError: if the MAC does not match. The message has been tampered with or the key is incorrect. """ if self.verify not in self._next: raise TypeError("verify() cannot be called" " when encrypting a message") self._next = [self.verify] if self._mac_tag is None: self._mac_tag = self._kdf.derive() secret = get_random_bytes(16) mac1 = BLAKE2s.new(digest_bits=160, key=secret, data=self._mac_tag) mac2 = BLAKE2s.new(digest_bits=160, key=secret, data=received_mac_tag) if mac1.digest() != mac2.digest(): raise ValueError("MAC check failed") def hexverify(self, hex_mac_tag): """Validate the *printable* MAC tag. This method is like `verify`. :Parameters: hex_mac_tag : string This is the *printable* MAC, as received from the sender. :Raises ValueError: if the MAC does not match. The message has been tampered with or the key is incorrect. """ self.verify(unhexlify(hex_mac_tag)) def encrypt_and_digest(self, plaintext, output=None): """Perform encrypt() and digest() in one step. :Parameters: plaintext : bytes/bytearray/memoryview The piece of data to encrypt. :Keywords: output : bytearray/memoryview The location where the ciphertext must be written to. If ``None``, the ciphertext is returned. :Return: a tuple with two items: - the ciphertext, as ``bytes`` - the MAC tag, as ``bytes`` The first item becomes ``None`` when the ``output`` parameter specified a location for the result. """ if self.encrypt not in self._next: raise TypeError("encrypt() can only be called after" " initialization or an update()") self._next = [ self.digest ] # Compute V (MAC) if hasattr(self, 'nonce'): self._kdf.update(self.nonce) self._kdf.update(plaintext) self._mac_tag = self._kdf.derive() cipher = self._create_ctr_cipher(self._mac_tag) return cipher.encrypt(plaintext, output=output), self._mac_tag def decrypt_and_verify(self, ciphertext, mac_tag, output=None): """Perform decryption and verification in one step. A cipher object is stateful: once you have decrypted a message you cannot decrypt (or encrypt) another message with the same object. You cannot reuse an object for encrypting or decrypting other data with the same key. This function does not remove any padding from the plaintext. :Parameters: ciphertext : bytes/bytearray/memoryview The piece of data to decrypt. It can be of any length. mac_tag : bytes/bytearray/memoryview This is the *binary* MAC, as received from the sender. :Keywords: output : bytearray/memoryview The location where the plaintext must be written to. If ``None``, the plaintext is returned. :Return: the plaintext as ``bytes`` or ``None`` when the ``output`` parameter specified a location for the result. :Raises ValueError: if the MAC does not match. The message has been tampered with or the key is incorrect. """ if self.decrypt not in self._next: raise TypeError("decrypt() can only be called" " after initialization or an update()") self._next = [ self.verify ] # Take the MAC and start the cipher for decryption self._cipher = self._create_ctr_cipher(mac_tag) plaintext = self._cipher.decrypt(ciphertext, output=output) if hasattr(self, 'nonce'): self._kdf.update(self.nonce) self._kdf.update(plaintext if output is None else output) self.verify(mac_tag) return plaintext def _create_siv_cipher(factory, **kwargs): """Create a new block cipher, configured in Synthetic Initializaton Vector (SIV) mode. :Parameters: factory : object A symmetric cipher module from `Crypto.Cipher` (like `Crypto.Cipher.AES`). :Keywords: key : bytes/bytearray/memoryview The secret key to use in the symmetric cipher. It must be 32, 48 or 64 bytes long. If AES is the chosen cipher, the variants *AES-128*, *AES-192* and or *AES-256* will be used internally. nonce : bytes/bytearray/memoryview For deterministic encryption, it is not present. Otherwise, it is a value that must never be reused for encrypting message under this key. There are no restrictions on its length, but it is recommended to use at least 16 bytes. """ try: key = kwargs.pop("key") except KeyError as e: raise TypeError("Missing parameter: " + str(e)) nonce = kwargs.pop("nonce", None) return SivMode(factory, key, nonce, kwargs)
Emails

<helderijs@gmail.com>

URLs

https://tools.ietf.org/html/rfc5297

http://blog.cryptographyengineering.com/2012/05/how-to-choose-authenticated-encryption.html

http://www.cs.ucdavis.edu/~rogaway/papers/keywrap.pdf

Extracted

Path

C:\Windows\Temp\is-103IS.tmp\probe\{app}\python\Lib\site-packages\Crypto\Cipher\is-3EN7P.tmp

Ransom Note
# -*- coding: utf-8 -*- # # Cipher/PKCS1_OAEP.py : PKCS#1 OAEP # # =================================================================== # The contents of this file are dedicated to the public domain. To # the extent that dedication to the public domain is not available, # everyone is granted a worldwide, perpetual, royalty-free, # non-exclusive license to exercise all rights associated with the # contents of this file for any purpose whatsoever. # No rights are reserved. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # =================================================================== from Crypto.Signature.pss import MGF1 import Crypto.Hash.SHA1 from Crypto.Util.py3compat import bord, _copy_bytes import Crypto.Util.number from Crypto.Util.number import ceil_div, bytes_to_long, long_to_bytes from Crypto.Util.strxor import strxor from Crypto import Random class PKCS1OAEP_Cipher: """Cipher object for PKCS#1 v1.5 OAEP. Do not create directly: use :func:`new` instead.""" def __init__(self, key, hashAlgo, mgfunc, label, randfunc): """Initialize this PKCS#1 OAEP cipher object. :Parameters: key : an RSA key object If a private half is given, both encryption and decryption are possible. If a public half is given, only encryption is possible. hashAlgo : hash object The hash function to use. This can be a module under `Crypto.Hash` or an existing hash object created from any of such modules. If not specified, `Crypto.Hash.SHA1` is used. mgfunc : callable A mask generation function that accepts two parameters: a string to use as seed, and the lenth of the mask to generate, in bytes. If not specified, the standard MGF1 consistent with ``hashAlgo`` is used (a safe choice). label : bytes/bytearray/memoryview A label to apply to this particular encryption. If not specified, an empty string is used. Specifying a label does not improve security. randfunc : callable A function that returns random bytes. :attention: Modify the mask generation function only if you know what you are doing. Sender and receiver must use the same one. """ self._key = key if hashAlgo: self._hashObj = hashAlgo else: self._hashObj = Crypto.Hash.SHA1 if mgfunc: self._mgf = mgfunc else: self._mgf = lambda x,y: MGF1(x,y,self._hashObj) self._label = _copy_bytes(None, None, label) self._randfunc = randfunc def can_encrypt(self): """Legacy function to check if you can call :meth:`encrypt`. .. deprecated:: 3.0""" return self._key.can_encrypt() def can_decrypt(self): """Legacy function to check if you can call :meth:`decrypt`. .. deprecated:: 3.0""" return self._key.can_decrypt() def encrypt(self, message): """Encrypt a message with PKCS#1 OAEP. :param message: The message to encrypt, also known as plaintext. It can be of variable length, but not longer than the RSA modulus (in bytes) minus 2, minus twice the hash output size. For instance, if you use RSA 2048 and SHA-256, the longest message you can encrypt is 190 byte long. :type message: bytes/bytearray/memoryview :returns: The ciphertext, as large as the RSA modulus. :rtype: bytes :raises ValueError: if the message is too long. """ # See 7.1.1 in RFC3447 modBits = Crypto.Util.number.size(self._key.n) k = ceil_div(modBits, 8) # Convert from bits to bytes hLen = self._hashObj.digest_size mLen = len(message) # Step 1b ps_len = k - mLen - 2 * hLen - 2 if ps_len < 0: raise ValueError("Plaintext is too long.") # Step 2a lHash = self._hashObj.new(self._label).digest() # Step 2b ps = b'\x00' * ps_len # Step 2c db = lHash + ps + b'\x01' + _copy_bytes(None, None, message) # Step 2d ros = self._randfunc(hLen) # Step 2e dbMask = self._mgf(ros, k-hLen-1) # Step 2f maskedDB = strxor(db, dbMask) # Step 2g seedMask = self._mgf(maskedDB, hLen) # Step 2h maskedSeed = strxor(ros, seedMask) # Step 2i em = b'\x00' + maskedSeed + maskedDB # Step 3a (OS2IP) em_int = bytes_to_long(em) # Step 3b (RSAEP) m_int = self._key._encrypt(em_int) # Step 3c (I2OSP) c = long_to_bytes(m_int, k) return c def decrypt(self, ciphertext): """Decrypt a message with PKCS#1 OAEP. :param ciphertext: The encrypted message. :type ciphertext: bytes/bytearray/memoryview :returns: The original message (plaintext). :rtype: bytes :raises ValueError: if the ciphertext has the wrong length, or if decryption fails the integrity check (in which case, the decryption key is probably wrong). :raises TypeError: if the RSA key has no private half (i.e. you are trying to decrypt using a public key). """ # See 7.1.2 in RFC3447 modBits = Crypto.Util.number.size(self._key.n) k = ceil_div(modBits,8) # Convert from bits to bytes hLen = self._hashObj.digest_size # Step 1b and 1c if len(ciphertext) != k or k<hLen+2: raise ValueError("Ciphertext with incorrect length.") # Step 2a (O2SIP) ct_int = bytes_to_long(ciphertext) # Step 2b (RSADP) m_int = self._key._decrypt(ct_int) # Complete step 2c (I2OSP) em = long_to_bytes(m_int, k) # Step 3a lHash = self._hashObj.new(self._label).digest() # Step 3b y = em[0] # y must be 0, but we MUST NOT check it here in order not to # allow attacks like Manger's (http://dl.acm.org/citation.cfm?id=704143) maskedSeed = em[1:hLen+1] maskedDB = em[hLen+1:] # Step 3c seedMask = self._mgf(maskedDB, hLen) # Step 3d seed = strxor(maskedSeed, seedMask) # Step 3e dbMask = self._mgf(seed, k-hLen-1) # Step 3f db = strxor(maskedDB, dbMask) # Step 3g one_pos = hLen + db[hLen:].find(b'\x01') lHash1 = db[:hLen] invalid = bord(y) | int(one_pos < hLen) hash_compare = strxor(lHash1, lHash) for x in hash_compare: invalid |= bord(x) for x in db[hLen:one_pos]: invalid |= bord(x) if invalid != 0: raise ValueError("Incorrect decryption.") # Step 4 return db[one_pos + 1:] def new(key, hashAlgo=None, mgfunc=None, label=b'', randfunc=None): """Return a cipher object :class:`PKCS1OAEP_Cipher` that can be used to perform PKCS#1 OAEP encryption or decryption. :param key: The key object to use to encrypt or decrypt the message. Decryption is only possible with a private RSA key. :type key: RSA key object :param hashAlgo: The hash function to use. This can be a module under `Crypto.Hash` or an existing hash object created from any of such modules. If not specified, `Crypto.Hash.SHA1` is used. :type hashAlgo: hash object :param mgfunc: A mask generation function that accepts two parameters: a string to use as seed, and the lenth of the mask to generate, in bytes. If not specified, the standard MGF1 consistent with ``hashAlgo`` is used (a safe choice). :type mgfunc: callable :param label: A label to apply to this particular encryption. If not specified, an empty string is used. Specifying a label does not improve security. :type label: bytes/bytearray/memoryview :param randfunc: A function that returns random bytes. The default is `Random.get_random_bytes`. :type randfunc: callable """ if randfunc is None: randfunc = Random.get_random_bytes return PKCS1OAEP_Cipher(key, hashAlgo, mgfunc, label, randfunc)
URLs

http://dl.acm.org/citation.cfm?id=704143

Targets

    • Target

      prtg_installer.exe

    • Size

      341.9MB

    • MD5

      3de61701ed11fc334ac81974a8151095

    • SHA1

      49cf1f4eb4fbde4388470b6ea8cf1fc0cb67889e

    • SHA256

      0dd1952b8ee8a56f77fba968366794bfa58abefc38151192d378eaf35607091f

    • SHA512

      b2a8d03585bcd1227f3a163d87f38c406722076709a7208eeb61e86fab5181e80230a538f37efb3786c5b1e475e10b7528d071aef8667f1aca0fab3564b0b63a

    • SSDEEP

      6291456:Komt7yD6gwdY0I2pUQKwFXfh9lAzooK+AwoEbt2iO/XhArMqs:dmtI6gwu0I2SXOh9lAzVAWERhGM

    • Drops file in Drivers directory

    • Modifies Windows Firewall

    • ASPack v2.12-2.42

      Detects executables packed with ASPack v2.12-2.42

    • Checks BIOS information in registry

      BIOS information is often read in order to detect sandboxing environments.

    • Checks computer location settings

      Looks up country code configured in the registry, likely geofence.

    • Executes dropped EXE

    • Loads dropped DLL

    • UPX packed file

      Detects executables packed with UPX/modified UPX open source packer.

    • Checks installed software on the system

      Looks up Uninstall key entries in the registry to enumerate software on the system.

    • Drops file in System32 directory

MITRE ATT&CK Matrix ATT&CK v6

Persistence

Modify Existing Service

1
T1031

Defense Evasion

Install Root Certificate

1
T1130

Modify Registry

1
T1112

Discovery

Query Registry

5
T1012

System Information Discovery

5
T1082

Peripheral Device Discovery

1
T1120

Tasks