blog-nov

Drill-down NATwork limited languages

In my previous three articles I discussed ways to provide increasing architectural surety surrounding sovereign network application infrastructure with Internet presence. In this 4th article I am discussing the use of limited languages in this architecture for going a step further.

As a reminder, the configuration is an external server handling requests by sending them through a named pipe to a reverse proxy ssh stream sourced behind a NAT gateway from the Red network from an application (javascript for example) running on a server with no other services communicating to the SSH tunnel through a named pipe on the server. This Red server is controlled by inbound SSH updates from the Green network which is NATed to the Red network and operates (for high surety cases) via store and forward digital diodes to the Red network, leaving no back traffic to Green. The data for the application on Red is kept in a database operated on the Purple network that listens to limited syntax on one side of a finite state machine and returns responses back through the syntax limiter, those connected directly to a reverse proxy ssh setup just as Red to the Internet interface operates. Deception is added to reduce attacker uncertainty in the Red server interface, the Red server operating environment, and the Red network; and anomaly detection is implemented by detecting deviations from known good behavior through digital diodes from networks to detection systems and with responses limited to 1-bit real-time indicators to neighboring interfaces of devices acting anomalously.

The first priority is to keep Green safe, the secondary priority is to keep database access to authorized activities, and the 3rd priority is to keep the Red server safe, where safe is prioritized as free of corruption (integrity), free of disruption (availability), free of misuse (use control), accountable, and with provenance. Note that secrecy is not really a goal, but to the extent it comes along for the ride, that is fine. Other details can be found in the other articles.

Limited function via limited languages

The basic concept is that by limiting the expressiveness of available languages you can eliminate general purpose functionality and all manner of attacks that increase functionality beyond intent. The second part of the concept is that you can implement limited languages with simple finite state machines that you can pretty much guarantee do what they are
supposed to.

In essence, by limiting input syntax sufficiently, you eliminate all functions other than those specifically needed for the specific application, eliminating any sort of SQL injection or alteration of the exact behaviors and queries the Red server is designed to implement. Since these are normally (or at least quite often) very specific queries with well controlled parameters that can be further controlled by careful naming conventions and character code
limitations, any sort of binary code, strange names, escape characters, complex query language components, and erroneous handling of all of these by a database server can be eliminated because they are impossible to pass to the database server. And since such limited syntax can be so easily implemented by small finite state machines not using any
underlying protocols or complex hardware mechanisms (such as DMAs), with high surety.

Let’s break that down with a few examples:

  • Instead of allowing general SQL queries to a database you introduce a new syntax that has a list of valid statements with ranges of valid arguments. Anything else is ignored, replied to with “REFUSED” or some such, or sent deception results. By example:
    • Login [Identifier] [Authenticator] → [SessionID] | [REFUSED] | [DeceptionID]
    • Get [table] [SessionId] [Item] → [data] | REFUSED | [DeceptionData]
    • Put [table] [SessionID] [Item] [data] → Checksum | REFUSED
    Identifiers are strings [A-Za-z0-9]+ with various appropriate caveats
  • Implementation can reliably be made by translating BNF specifications into finite state machines or machine code through languages like YACC or direct finite state machine design. The output of the parsed sequence can then be turned into SQL or whatever language is used by the database without uncertainty about any possibility of it becoming a statement other than the appropriate database request for the defined and constrained set of allowable queries. Responses may be returned verbatim.
  • In this scenario, the database server takes login credentials, provides a limited time/usage 1024 bit pseudo-randomly generated Session ID, and based on SessionID grants, denies, or deceives access requests. All fields are finite limited maximum length with terminators not allowed in the content, so there are no input sequences that can produce a query that can cause translation into any undesired behavior.

The only potential problem is queries using stolen SessionID information or identification and authentication information, and these can only perform the legitimate requests of authorized users. For that reason they generate no path to attack Green or the Purple database other than authorized queries and responses.

Implementing such an FSM is simple and can be done by hand or by automation very easily with implementation on a FPGA, EEPROM, Arduino, or similar simple hardware mechanism and verified for correctness. Regardless of the capabilities of the back end server, only valid requests can be made through this interface and only authorized requests will be permitted. Instead of using hardware network interfaces, as an example, serial ports can be used so that one bit at a time is passed into a sequential machine for syntax checking, and no flawed hardware attack is likely to be exploited because the system is too simple and dumb to have complex paths that can be identified and exploited..

On a different interface for a different (e.g., internal) system, a different syntax (language) can be used with its own FSM for control. For example a database administrator could add user identifiers and authenticators from a separate interface to the database (Purple) network.

In the context of the previous papers, these devices operate through a reverse tunnel gateway (if desired), although frankly, I don’t think you need it with this class of surety mechanism. These sorts of mechanisms can be provided very inexpensively to meet specifications, and exhaustively tested except for field values which can be tested at edges of the decision mechanisms. Redundant versions can be made as triple (or higher) modular redundant systems to assure hardware fault coverage to a desired extent and reliability in the presence of faults. Diodes for real-time verification systems and upstream response can also be put in place if desired.

In the applications running in this architecture, inputs can also be substantially restricted, even though they are themselves operating in as lower surety manner and environment. As an example,

  • I implemented a system for operating incoming sales and processing similar to a CRM system in a few days using GAI to produce all of the code, and have been running that application in this architecture since implementation. The input is limited in several ways:
    • Initial entry into the system is done by sending HTML content to the requesting system in response to a limited length and syntax http “Get” request.
      • The response to the Get request loads an encryption and authenticated layer sending and receiving JSON-stringify(ed) content only.
      • Note responses arrive at the application in the form of a names pipe as a sequence of bytes and not as an Ethernet or Internet frame or datagram.
    • All subsequent traffic is encrypted, authenticated, and in the form of JSON stringed sequences.
      • On receipt by the server, the traffic is first decrypted and authenticated, and if this fails, it is ignored or deceived.
      • The subsequent content is verified as a valid JSON stringified sequence and then parsed via JSON.parse to produce the actual request. Any sequence not meeting this syntax requirement is ignored or deceived.
      • The input processing only uses defined fields and value types for those fields and all other content triggers deception or is ignored.
  • The surety of this mechanism is not as high quality (although it could be made so) as the networking components because it operates in a normal operating environment which, although it has additional protections, is based on code in widespread use, some of which is found to have flaws from time to time.
    • Rather than update this code and risk supply chain attacks, when flaws are published, if the can trigger potential known failure modes, these are limited by additional input filtering or further separation of the application components.
    • As an example, if the Ssh reverse tunnel became vulnerable to exploitation, it could be separated and placed into an independent component with appropriate surveillance for detecting subversion and isolated in a manner similar to the database from the rest of the implementation. The same is true for the decryption and parsing components.

The applications themselves of course may take more time to develop, not because they are somehow extra secure, which they are not, but because they tend to be more complicated than the NATwork setup, configuration, and so forth. But with AI in the state it is in today, many such applications can be developed very quickly. These applications tend to have poor
security properties, but exploiting them tends to require finding a flaw in their operating environment reachable from the external interface, and this architecture substantially limits such input sequences.

Such flaws typically do not directly enable server takeover, but sometimes produce arbitrary code execution as the user operating the application. The related set of defenses have been discussed in the previous papers in this series. The common result of such flaws being exploited include application or system crashes, bad data values, inconsistent results, wrong decisions at conditionals in then application, lack of readability due to bad interfaces, injection of code affecting the browser appearance or operation of the requesting browser, undesired authorized behaviors, cross-connecting different users, and these sorts of things.

Recall that the priorities are:

  • Top priority is to keep Green safe (from external influences)
    • No application flaw in Red can directly effect any of the identified properties of Green.
    • An indirect effect would require a path to influence Green, and unless the applications can do things like change the physical environment enveloping Green, I see no application exploitation path to do this.
  • Secondary priority is to keep database access to authorized activities
    • No application change can cause the Purple database machine to do anything the syntax filtering does not allow to pass, however, a Red machine application exploit can potentially cause content to be other than what it should be (corruption), induce enough requests or a complex enough nature in a short enough time frame to slow or potentially even crash the database server (service denial), and cause false association of activities with authorized parties (misuse).
  • Tertiary priority is to keep the Red server safe
    • Not having defined safe explicitly, if the application does not properly run it is possible for an attack on the application to cause corruption to the server it operates in, disrupt its operations, gain the ability to take over the server itself and thus misuse it, destroy accountability for activities after its takeover, and produce false provenance after its takeover.
    • Other protections to moderate these effects are identified in previous articles in the series.

What’s the point?

It’s about the tradeoff of surety for cost and leverage against threat actors. All of this plus the things identified in the first 3 articles in this series can be implemented for under $1,000 of initial cost, require essentially no maintenance (I have run such systems for many months,
and occasional a year or more with no maintenance at all, and when maintenance was required it has always been either a reboot or a power supply failure requiring component replacement), and spending a total of less than a week of effort (if you know what you are doing) for implementation.

Conclusions

This discussion and series of articles is intended to foster paths forward for changing the equation of how attack and defense work, and to focus on the value and capabilities of longknown architectural protections in changing the leverage for defenders. I hope it does so. Click here to read complete blog

Leave a Comment

Scroll to Top