Stronghold Enhancement Proposal: Procedures Isolation #375
Replies: 3 comments 1 reply
-
I wonder if we can add a rule to make it so that a remote stronghold can not run a custom proc if the proc doesn't exist on the local stronghold. Aka, if I write a proc for Sr25519 key derivation, if that custom macro isn't in the compiled stronghold that I am trying to access remotely, the proc just fails. It might be safer in general to just not allow custom procs to run on remote vaults but maybe the middle ground would be to have set of options that can turn the capabilities on and off to certain degrees. |
Beta Was this translation helpful? Give feedback.
-
Nice proposal! I definitely like how this would make it much easier to do simple operations on keys that currently all require a separate procedure, like a simple concatenation of two secrets. I'm not sure if I understand the security model completely yet. How does the system distinguish between me calculating the public key to a private key and me base64 encoding the private key? Both are operations on the key and both result in a different sequence of bytes, but one does not allow me to extract the private key while the other does. Is this supposed to be caught by the system and if so, how, or is it up to the procedure implementer to avoid that? The other part is that the current procedure centralization in Stronghold also has advantages. Namely that the security of the procedures are automatically checked by the stronghold team since it's part of the code base. When each project implements their own cryptographic procedures, the likelihood of bugs is higher. So some alternative for providing shared, common procedures is needed, in my opinion. A stronghold extensions library that implements common procedures might be good. There's certainly a trade-off between having to maintain all the procedures but being able to guarantee a cetain level of security, and the inverse.
I'm guessing the techniques that don't require elevated privileges would be much preferable? Otherwise the entire binary that stronghold is a part of needs to run with those elevated privileges which seems undesirable and would be a significant hurdle in practice. |
Beta Was this translation helpful? Give feedback.
-
Hi Philipp!
As of now, this would be the responsibility of the implementer to mark regions intended for transfer as "safe". My idea would be create those memory regions by the
I partly concur with your argument here, as providing new functionality to Stronghold would require a process to follow up and create more transparency in terms of security. However, even the current procedures system only makes use of software based guards. There is another proposal for hardware secure modules ( HSM ) coming up. The idea would be to coordinate efforts to make the integration seamless.
As of now and to the best of my knowledge, anti-debugging techniques would not require elevated privileges. Employing other techniques ( eg eBPF as mentioned above) might require elevated privileges, but come with their own problems when using unprivileged. To summarize my answer a threat model would be required to evaluate the severity of the problems mention above. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
SEP: Procedures Isolation
TOC
Outline
The procedures API shall be more generalized by accepting a generic closure. A proposed runtime control flow checker shall ensure the memory isolation of sensitive data and reject and illegal operations on specific memory regions like copying and moving to avoid exposure of sensitive data held inside a vault.
top ^
Motivation
The current procedures API offers great flexibility to work with sensitive data inside a vault, ressembling the architecure of a pipeline with generators ( eg. create keypairs and store the private part inside a target location), processors ( eg. extract the public key from a private key and expose it), and receivers ( derive a child private / public key pair and store it inside a location). Due to security constraints the procedures API cannot allow custom procedures to be run. The risk of exposing stored secrets by supplying a custom procedure would be possible and render the security model obsolete. This restriction brings the burden to Stronghold to always supply required cryptographic procedures.
This proposal shall describe a possible alternative to leverage this burden by providing a standardized interface that accepts a closure to work with sensitive data. Care must be taken for those use cases where some data shall be exposed intentionally like the extraction of a public key. A runtime control flow checker must ensure that exposable data is never stored in a location.
top ^
Reference-Level Explanation
Interface
An interface providing desired functionality might look like this:
The following code snipped exemplifies the construction of a closure that accesses secrets on desired location and writes desired output into a generalized container.
top ^
Procedures Executor and Runtime Checking
As briefly introduced the core element for secure closure execution is a component we call a
Sentinel
. ASentinel
is divided into a plain trait and an actual implementation depending on the operating system.top ^
Sentinel Implementation Under Linux Based Systems with Kernel version > 5.x
As security models and utilites vary between major operating systems, this section will focus on the implementation on linux side. A schematic view as shown in fig. 1 displays two security boundaries, the outer boundary is a sentinel that works as a checkpoint for data flows.
fig 1.
An implementation would need to take care of process forking and isolation. forking would be necessary to enforce kernel controlled access flags. The proposed Sentinel should also take care of intercepting system calls. An executing closure shall not be able to leak any information, and only authorized system calls shall be allowed.
System call interception can either be implemented via debugging techniques or by newer platform techniques like eBPF. The latter might require elevated system privileges.
Runtime data flows can be tracked by a technique called taint analysis. The proposed Sentinel must take care of transferable regions of memory. Sensitive data inside the vault must always appear tainted, and shall be denied transfer to so called authenticated memory. The Sentinel would keep shadow memory to store metainformation about tainted data. It is to be decided how many "colors" shall exist. The Stronghold use case might require at least one color (either tainted or not tainted to allow exposing data).
Some definitions on tained data analysis:
TaintedSinks
TaintedSources
Tainted Propagation
and must be handled by the Sentinel.todo: provide some prototypical implementation, highlight the core algorithm
Sentinel Implementation Under Windows > 8.x
prose
Sentinel Implementation Under BSD Based Systems (MacOS)
prose
Procedure Execution from Trusted Network Sources
prose
top ^
Edge Cases
prose
top ^
Threat Modeling
Below is a table of possible attack scenarios with a short description on the use cases given by an attacker.
todo: more use-cases
top ^
Drawbacks
Isolating sensitive regions of memory in software is always dependent on the operating systems capabilities. As the awareness grows towards secure software engineering, implementing dextrous methods to keep data safe is always a race against time and malicous actors who will always try to break security restrictions at all costs. This brings us to the usefulness of the described approach that intends to lift some restrictions on Stronghold procedures, but provide the same or higher security guarantees at runtime.
In order to separte the discussion on the drawbacks of the proposed system, we need to separate our concerns between local execution, and remote execution inside a p2p setup.
top ^
Rationale and Alternatives
The described feature extends the flexibility to work on sensitive data in an isolated and controlled environment, while mitigating, if not excluding any possibility to access sensitive data stored inside the vault. Building secure systems is always bound to a half-life of the actual involved security, thus a current implementation might be breached by some unforseen technique. Many examples from the past have shown that virtually any system can be breached. However, for Stronghold the alternative would be to support and implement custom procedures on a per-demand basis that would bind resources, require careful code inspection and eventually human failure to detect bugs or sensitive information leakage. The proposed functional draws heavy inspiration from other open source projects, but decides to not directly rely on them rather offer corporation and to keep the number of dependencies small. We consider this crucial for an easy adaption on future threats.
top ^
Prior art
We are currently not aware of a similar system setup to execute generic procedures in an isolated environment but matured techniques to mitigate / defend against sophisticated attacks like ROP, Code Injection, Buffer Overflows etc.
top ^
Unresolved Questions
/guard
top ^
Future Possibilities
Executing procedures could be functionally coupled with a hierarchical permission system. This could either reflect a user's set of permission to access only a subset of secrets. This could be useful for profiles on an integrating application. Other use-cases of a hierarchical permission system could be access and execution from a trusted source over a p2p network.
top ^
Resources
Beta Was this translation helpful? Give feedback.
All reactions