Narcissus: Deriving Correct-By-Construction Decoders and Encoders from Binary Formats

03/13/2018
by   Sorawit Suriyakarn, et al.
0

Every injective function has an inverse, although constructing the inverse for a particular injective function can be quite tricky. One common instance of inverse-function pairs is the binary encoders and decoders used to convert in-memory data into and out of a structured binary format for network communication. Ensuring that a given decoder is a proper inverse of the original encoder is particularly important, as any error has the potential to introduce security vulnerabilities or to corrupt or lose data in translation. In this paper, we present a synthesis framework, Narcissus, that eliminates both the tedium and the potential for error in building the inverse of a binary encoder. The starting point of the process is a binary format, expressed as a functional program in the nondeterminism monad, that precisely captures all the valid binary encodings of an arbitrary datatype instance. From this specification, Narcissus synthesizes a decoder that is guaranteed to be the inverse of this relation, drawing on an extensible set of decoding strategies to construct the implementation. Each decoder is furthermore guaranteed to detect malformed encodings by failing on inputs not included in this relation. The derivation is carried out inside the Coq proof assistant and produces a proof trail certifying the correctness of the synthesized decoder. We demonstrate the utility of our framework by deriving and evaluating the performance of decoders for all packet formats used in a standard network stack.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
09/08/2018

Exploiting Invertible Decoders for Unsupervised Sentence Representation Learning

The encoder-decoder models for unsupervised sentence representation lear...
research
09/23/2021

FormatFuzzer: Effective Fuzzing of Binary File Formats

Effective fuzzing of programs that process structured binary inputs, suc...
research
11/02/2022

Verified Reversible Programming for Verified Lossless Compression

Lossless compression implementations typically contain two programs, an ...
research
03/28/2020

On the inverses of Kasami and Bracken-Leander exponents

We explicitly determine the binary representation of the inverse of all ...
research
05/05/2020

An improved estimate of the inverse binary entropy function

Two estimates for the inverse binary entropy function are derived using ...
research
05/11/2023

Zero-Error Distributed Function Compression for Binary Arithmetic Sum

In this paper, we put forward the model of zero-error distributed functi...
research
08/06/2023

WASMixer: Binary Obfuscation for WebAssembly

WebAssembly (Wasm) is an emerging binary format that draws great attenti...

Please sign up or login with your details

Forgot password? Click here to reset