# US 2022/0294757 A1 · Machine learning-based dns request string representation with hash replacement

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2022/0294757 A1
- Document ID: US20220294757A1
- Status: Published application
- Kind: A1
- Application number: 17/197,375
- Filed: 2021-03-10
- Published: 2022-09-15
- Earliest claimed: 2021-03-10
- Assignees: Oracle International Corporation
- Applicants: Oracle International Corporation
- Inventors: Renata Khasanova; Felix Schmidt; Stuart Wray; Craig Schelp; Nipun Agarwal; Matteo Casserini
- Web page: https://patentgrep.com/patent/US20220294757A1

## CPC

- H04L 61/4511: using domain name system [DNS]
- G06N 3/0455: Auto-encoder networks; Encoder-decoder networks
- G06N 3/088: Non-supervised learning, e.g. competitive learning
- G06N 20/00: Machine learning
- H04L 41/16: using machine learning or artificial intelligence
- G06F 40/30: Semantic analysis
- H04L: TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION (arrangements common to telegraphic and telephonic communication H04M)
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Techniques are described herein for using machine learning to learn vector representations of DNS requests such that the resulting embeddings represent the semantics of the DNS requests as a whole. Techniques described herein perform pre-processing of tokenized DNS request strings in which hashes, which are long and relatively random strings of characters, are detected in DNS request strings and each detected hash token is replaced with a placeholder token. A vectorizing ML model is trained using the pre-processed training dataset in which hash tokens have been replaced. Embeddings for the DNS tokens are derived from an intermediate layer of the vectorizing ML model. The encoding application creates final vector representations for each DNS request string by generating a weighted summation of the embeddings of all of the tokens in the DNS request string. Because of hash replacement, the resulting DNS request embeddings reflect semantics of the hashes as a group.

## Claims

### Claim 1

A computer-executed method comprising:
pre-processing a training dataset, that comprises a plurality of DNS request strings, to produce a pre-processed training dataset;
wherein pre-processing the training dataset comprises:
tokenizing the plurality of DNS request strings, in the training dataset, to produce a corresponding plurality of tokenized DNS strings;
for each tokenized DNS string of one or more tokenized DNS strings, from the plurality of tokenized DNS strings:
identifying a hash token, in said each tokenized DNS string based, at least in part, on a length of the hash token and a number of unique characters in the hash token, and
replacing the identified hash token with a particular placeholder token;
training a vectorizing machine learning (ML) model based, at least in part, on the pre-processed training dataset to produce a trained vectorizing ML model; and
generating vector representations of the plurality of DNS request strings based, at least in part, on DNS token embeddings in an intermediate layer of the trained vectorizing ML model;
wherein the method is performed by one or more computing devices.

### Claim 2 (depends on 1)

The computer-executed method of claim 1, wherein training the vectorizing ML model comprises training the vectorizing ML model to predict a particular DNS token given one or more context tokens, other than the particular DNS token, from a particular DNS request string of the pre-processed training dataset.

### Claim 3 (depends on 1)

The computer-executed method of claim 1, wherein training the vectorizing ML model comprises training the vectorizing ML model to predict one or more context DNS tokens, of a particular DNS request string of the pre-processed training dataset, given a particular DNS token from the particular DNS request string.

### Claim 4 (depends on 1)

The computer-executed method of claim 1, wherein identifying the hash token comprises calculating a logarithm of the number of unique characters in the hash token multiplied by the length of the hash token.

### Claim 5 (depends on 1)

The computer-executed method of claim 1, wherein identifying the hash token comprises calculating an entropy metric for the hash token and determining that the entropy metric exceeds a threshold metric.

### Claim 6 (depends on 5)

The computer-executed method of claim 5, further comprising deriving the threshold metric from the training dataset.

### Claim 7 (depends on 1)

The computer-executed method of claim 1, further comprising training a second ML model based, at least in part, on the stored vector representations of the plurality of DNS request strings to produce a trained second ML model.

### Claim 8 (depends on 7)

The computer-executed method of claim 7, wherein the plurality of DNS request strings is a first plurality of DNS request strings, and wherein the method further comprises using the trained second ML model to predict that second one or more DNS request strings, from a second plurality of DNS request strings other than the first plurality of DNS request strings, represent exfiltration attacks.

### Claim 9 (depends on 7)

The computer-executed method of claim 7, wherein the plurality of DNS request strings is a first plurality of DNS request strings, and wherein the method further comprises using the trained second ML model to predict that second one or more DNS request strings, from a second plurality of DNS request strings other than the first plurality of DNS request strings, are anomalous DNS request strings.

### Claim 10

One or more non-transitory computer-readable media storing one or more sequences of instructions that, when executed by one or more processors, cause:
pre-processing a training dataset, that comprises a plurality of DNS request strings, to produce a pre-processed training dataset;
wherein pre-processing the training dataset comprises:
tokenizing the plurality of DNS request strings, in the training dataset, to produce a corresponding plurality of tokenized DNS strings;
for each tokenized DNS string of one or more tokenized DNS strings, from the plurality of tokenized DNS strings:
identifying a hash token, in said each tokenized DNS string based, at least in part, on a length of the hash token and a number of unique characters in the hash token, and
replacing the identified hash token with a particular placeholder token;
training a vectorizing machine learning (ML) model based, at least in part, on the pre-processed training dataset to produce a trained vectorizing ML model; and
generating vector representations of the plurality of DNS request strings based, at least in part, on DNS token embeddings in an intermediate layer of the trained vectorizing ML model.

### Claim 11 (depends on 10)

The one or more non-transitory computer-readable media of claim 10, wherein training the vectorizing ML model comprises training the vectorizing ML model to predict a particular DNS token given one or more context tokens, other than the particular DNS token, from a particular DNS request string of the pre-processed training dataset.

### Claim 12 (depends on 10)

The one or more non-transitory computer-readable media of claim 10, wherein training the vectorizing ML model comprises training the vectorizing ML model to predict one or more context DNS tokens, of a particular DNS request string of the pre-processed training dataset, given a particular DNS token from the particular DNS request string.

### Claim 13 (depends on 10)

The one or more non-transitory computer-readable media of claim 10, wherein identifying the hash token comprises calculating a logarithm of the number of unique characters in the hash token multiplied by the length of the hash token.

### Claim 14 (depends on 10)

The one or more non-transitory computer-readable media of claim 10, wherein identifying the hash token comprises calculating an entropy metric for the hash token and determining that the entropy metric exceeds a threshold metric.

### Claim 15 (depends on 14)

The one or more non-transitory computer-readable media of claim 14, wherein the one or more sequences of instructions further comprise instructions that, when executed by one or more processors, cause deriving the threshold metric from the training dataset.

### Claim 16 (depends on 10)

The one or more non-transitory computer-readable media of claim 10, wherein the one or more sequences of instructions further comprise instructions that, when executed by one or more processors, cause training a second ML model based, at least in part, on the stored vector representations of the plurality of DNS request strings to produce a trained second ML model.

### Claim 17 (depends on 16)

The one or more non-transitory computer-readable media of claim 16, wherein the plurality of DNS request strings is a first plurality of DNS request strings, and wherein the one or more sequences of instructions further comprise instructions that, when executed by one or more processors, cause using the trained second ML model to predict that second one or more DNS request strings, from a second plurality of DNS request strings other than the first plurality of DNS request strings, represent exfiltration attacks.

### Claim 18 (depends on 16)

The one or more non-transitory computer-readable media of claim 16, wherein the plurality of DNS request strings is a first plurality of DNS request strings, and wherein the one or more sequences of instructions further comprise instructions that, when executed by one or more processors, cause using the trained second ML model to predict that second one or more DNS request strings, from a second plurality of DNS request strings other than the first plurality of DNS request strings, are anomalous DNS request strings.
