Dark Reading is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them.Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

Application Security

Security Lessons From a New Programming Language

A security professional needed a secure language for IoT development. So he wrote his own, applying learned lessons about memory and resources in the process.

When a security researcher needs to create an application, there are many choices in terms of programming languages and frameworks. But when project requirements include SSL and an embedded Internet of Things (IoT) platform, the number of good options becomes limited. That's why Thomas Pornin decided to build his own language.

Pornin, who is technical director and member of the cryptography services practice at NCC Group, has been thinking about programming languages, their strengths, and their weaknesses for more than 30 years. He has worked on many different, complex tech deployments and has the experience of launching an open source project, BearSSL, an SSL stack that is smaller than most SSL implementations available to developers.

The language Pornin wanted to build had two significant requirements: First, its resulting applications had to fit onto a resource-constrained IoT device, and that those applications performed reasonably well. Next, the applications developed using the language would not be subject to certain built-in vulnerabilities seen in some applications. Those vulnerabilities tend to revolve around the way the processor allocates and uses memory, so Pornin focused on memory in his thinking about language security.

Getting the project started took time. "I took care to write a big specification, a 65-page document," Pornin says. "In it, I explained how it should work and why it should work that way."

From Spec to Language
The initial specification was the basis for T0, Pornin's first pass at the programming language. T0 was designed to create applications that would work on an embedded system — defined as one with severely limited memory resources, a CPU that's not very powerful, no memory management unit, and no operating system to mediate the application's interaction with the hardware.

Pornin decided to base the design of his secure IoT language on Forth — a programming language that is oriented around the idea of stacks (memory structures where the last item pushed in is the first thing pulled out). He says the decision was partially driven by practical considerations about the discipline that stacks impose on the way memory is used, and partially by aesthetics. The stack orientation means that Forth code uses a distinctive notation (Reverse Polish Notation) familiar to anyone who used an HP calculator without the "=" key.

T0 was able to create compact, operational code. Pornin simplified the job of writing the T0 compiler by having it produce C source code as its output — code that then had to be recompiled and linked into the final executable code using an existing C compiler. It was much of what he wanted, but it was not yet secure. That waited for T1.

The Next Step
In T1, which Pornin described in a presentation at NorthSec 2019, protection for memory and restrictions on stacks were introduced. While Pornin is still working on building out the details of T1 and creating the full compiler for the language, he believes the language is moving in his desired direction.

There are already a number of languages that can be used for embedded applications. Depending on the hardware in use, C, Java ME, Go, Rust Embedded, and Forth may be possibilities. So does Pornin think other security practitioners should write their own programming languages?

"I think that anybody who is really serious about development should have the idea somewhere in their head," he says. "They should think about what they would like to see in a programming language." He adds with a laugh, "And it would also be good for people at large if most would stop before actually doing it."

It is useful, though, for developers and security practitioners to understand how the compilers work and the sort of code they produce. Understanding whether they create code that makes the most of memory protection and memory structures available in the hardware can help them write more secure, more robust applications.

Related Content:

 

Black Hat USA returns to Las Vegas with hands-on technical Trainings, cutting-edge Briefings, Arsenal open-source tool demonstrations, top-tier security solutions, and service providers in the Business Hall. Click for information on the conference and to register.

 

 

 

 

Curtis Franklin Jr. is Senior Editor at Dark Reading. In this role he focuses on product and technology coverage for the publication. In addition he works on audio and video programming for Dark Reading and contributes to activities at Interop ITX, Black Hat, INsecurity, and ... View Full Bio

Comment  | 
Print  | 
More Insights
Comments
Newest First  |  Oldest First  |  Threaded View
Aviation Faces Increasing Cybersecurity Scrutiny
Kelly Jackson Higgins, Executive Editor at Dark Reading,  8/22/2019
Microsoft Tops Phishers' Favorite Brands as Facebook Spikes
Kelly Sheridan, Staff Editor, Dark Reading,  8/22/2019
Capital One Breach: What Security Teams Can Do Now
Dr. Richard Gold, Head of Security Engineering at Digital Shadows,  8/23/2019
Register for Dark Reading Newsletters
White Papers
Video
Cartoon
Current Issue
7 Threats & Disruptive Forces Changing the Face of Cybersecurity
This Dark Reading Tech Digest gives an in-depth look at the biggest emerging threats and disruptive forces that are changing the face of cybersecurity today.
Flash Poll
Twitter Feed
Dark Reading - Bug Report
Bug Report
Enterprise Vulnerabilities
From DHS/US-CERT's National Vulnerability Database
CVE-2016-6154
PUBLISHED: 2019-08-23
The authentication applet in Watchguard Fireware 11.11 Operating System has reflected XSS (this can also cause an open redirect).
CVE-2019-5594
PUBLISHED: 2019-08-23
An Improper Neutralization of Input During Web Page Generation ("Cross-site Scripting") in Fortinet FortiNAC 8.3.0 to 8.3.6 and 8.5.0 admin webUI may allow an unauthenticated attacker to perform a reflected XSS attack via the search field in the webUI.
CVE-2019-6695
PUBLISHED: 2019-08-23
Lack of root file system integrity checking in Fortinet FortiManager VM application images of all versions below 6.2.1 may allow an attacker to implant third-party programs by recreating the image through specific methods.
CVE-2019-12400
PUBLISHED: 2019-08-23
In version 2.0.3 Apache Santuario XML Security for Java, a caching mechanism was introduced to speed up creating new XML documents using a static pool of DocumentBuilders. However, if some untrusted code can register a malicious implementation with the thread context class loader first, then this im...
CVE-2019-15092
PUBLISHED: 2019-08-23
The webtoffee "WordPress Users & WooCommerce Customers Import Export" plugin 1.3.0 for WordPress allows CSV injection in the user_url, display_name, first_name, and last_name columns in an exported CSV file created by the WF_CustomerImpExpCsv_Exporter class.