Skip to content

ScanLsb

This scanner checks if there is any hidden strings at the end of each RGB value

Source code in strelka/src/python/strelka/scanners/scan_lsb.py
class ScanLsb(strelka.Scanner):
    """This scanner checks if there is any hidden strings at the end of each RGB value"""

    def scan(self, data, file, options, expire_at):
        try:
            image = np.frombuffer(data, np.uint8)
            image = cv2.imdecode(image, cv2.IMREAD_COLOR)
            bits = self._get_bits(image)
            bytes_ = self._get_bytes(bits)
            chars = []
            chars.append(self._convert_bytes_to_text(bytes_))
            flag = "".join(chars).encode("ascii", "ignore")
            self.event["lsb"] = len(flag) > 1
        except AttributeError:
            self.flags.append("bits_image_error")
        except cv2.error:
            self.flags.append("cv2_image_error")

    def _get_bits(self, img):
        h, w, t = img.shape
        bits = ""

        for x in range(0, h):
            for y in range(0, w):
                lst = img[x, y]
                for k in lst:
                    bits += bin(k)[-1]
            return bits

    def _convert_bytes_to_text(self, bytes_):
        asc = ""
        for byte_ in bytes_:
            asc += chr(int(byte_, 2))
        return asc

    def _get_bytes(self, bits):
        bytes_ = []
        for i in range(int(len(bits) / 8)):
            bytes_.append(bits[i * 8 : (i + 1) * 8])
            # print(bytes_)
        return bytes_

Features

The features of this scanner are detailed below. These features represent the capabilities and the type of analysis the scanner can perform. This may include support for Indicators of Compromise (IOC), the ability to emit files for further analysis, and the presence of extended documentation for complex analysis techniques.

Feature
Support
IOC Support
Emit Files
Extended Docs
Malware Scanner
Image Thumbnails

Tastes

Strelka's file distribution system assigns scanners to files based on 'flavors' and 'tastes'. Flavors describe the type of file, typically determined by MIME types from libmagic, matches from YARA rules, or characteristics of parent files. Tastes are the criteria used within Strelka to determine which scanners are applied to which files, with positive and negative tastes defining files to be included or excluded respectively.

Source Filetype
Include / Exclude
ScanTranscode
bmp_file
image/jpeg
image/png
image/webp
image/x-ms-bmp
jpeg_file
png_file

Scanner Fields

This section provides a list of fields that are extracted from the files processed by this scanner. These fields include the data elements that the scanner extracts from each file, representing the analytical results produced by the scanner. If the test file is missing or cannot be parsed, this section will not contain any data.

Failure

No fields to display. The test file may not exist or could not be processed.

Sample Event

Below is a sample event generated by this scanner, demonstrating the kind of output that can be expected when it processes a file. This sample is derived from a mock scan event configured in the scanner's test file. If no test file is available, this section will not display a sample event.

Failure

Test file not found for scanner lsb