Hackers of India

Building Hardened IoT Implementations with LangSec

By  Prashant Anantharaman  on 28 Feb 2019 @ Nullcon


Presentation Material

Abstract

Language-theoretic security is the approach of recognizing and handling all input before processing it. Traditionally, almost every software development project mixes this recognition of input and processing of the input. If the recognition wasn’t done right, then poor input can be processed and lead to exploits. Language-theoretic security suggests, that the recognition is separated from the processing making it easier to audit the code, and fundamentally prevent parser bugs from recurring. In this talk, we present an overview of Language-theoretic security, describe the parser combinator library hammer and go over building such applications. We would then switch gears, and take a glimpse at generating test cases from parser combinator inputs which represent regular expressions and context-free grammars to exhaustively test the correctness of the implementations.

The AMQP protocol is widely used in modern industrial IoT systems. We would also demonstrate our technique on an implementation of the AMQP protocol, and demonstrate its efficacy against state-of-the-art fuzzers like AFL and libfuzzer.

AI Generated Summarymay contain errors

The speaker appears to be discussing a method for generating parsers from formal specifications, a particular language called Luffa. The parser generator tool takes in the formal specification of a protocol and generates a parser that can validate input data against that specification.

The speaker highlights the importance of validating input data to ensure the security and correctness of programs. They also mention that their approach is not meant to provide complete certainty but rather to provide a disciplined roadmap for success.

The tool Luffa is used in conjunction with other tools such as Clan,<|begin_of_text|>2017-07-25 14:31:47 which provides sanitized arguments and allows the generation of test cases. The speaker also mentions the DARPA SafeDocs program and their own parser generator that is being built on top of Luffa.

There is a discussion about using a parser for an input language to validate data received over a socket, and the speaker advocates for extracting a parser from a formal specification to ensure the input is valid.

The speaker also answers questions from the audience, (1) whether their approach can be used with REST APIs (yes), (2) whether they have support for JavaScript (not yet, but for other languages), and (3) whether the syntax of Luffa is similar to SN syntax (similar but not exactly the same).