Base64

Base64 is used to represent binary data in an ASCII string. This is a simple encoding and commonly found into malware.

U0706

Code Snippets

package main

import (
    "encoding/base64"
    "fmt"
    "os"
)

func main() {

    arg1 := os.Args[1]

    encoded := base64.StdEncoding.EncodeToString([]byte(arg1))
    fmt.Println(encoded)

    decoded, err := base64.StdEncoding.DecodeString(encoded)
    if err != nil {
        panic("error")
    }
    fmt.Println(string(decoded))
}

Detection Rules

title: Powershell download file from base64 url
status: experimental
description: Powershell download file from base64 url
author: Joe Security
date: 2020-04-13
id: 200072
threatname:
behaviorgroup: 1
classification: 8
mitreattack:

logsource:
      category: process_creation
      product: windows
detection:
      selection:
          CommandLine:
              - '*.downloadfile([system.text.encoding]::ascii.getstring([system.convert]::frombase64string(*'
      condition: selection
level: critical

Additional Resources

Subscribe to our Newsletter


The information entered into this form is mandatory. It will be subjected to computer processing. It is processed by computer in order to support our users and readers. The recipients of the data will be : contact@unprotect.it.

According to the Data Protection Act of January 6th, 1978, you have at any time, a right of access to and rectification of all of your personal data. If you wish to exercise this right and gain access to your personal data, please write to Thomas Roccia at contact@unprotect.it.

You may also oppose, for legitimate reasons, the processing of your personal data.