Spectra Assure
Community
Docs
warningRisk: Hardening
Scanned: about 22 hours ago

ffi

latest
Top 100
Ruby FFI
License: Permissive (BSD-3-Clause)
Published: 8 months ago




SAFE Assessment

Compliance

Licenses
No license compliance issues
Secrets
No sensitive information found

Security

Vulnerabilities
No known vulnerabilities detected
Hardening
8 reduced effectiveness mitigations

Threats

Tampering
No evidence of software tampering
Malware
No evidence of malware inclusion

Popularity

941.33M
Total Downloads
Contributors
Declared Dependencies
1.27k
Dependents

Top issues

Problem

Stack canary is a special value written onto the stack that allows the operating system to detect and terminate the program if a stack overrun occurs. Older compilers might generate stack cookies in a way that makes it possible to determine their value, allowing the attacker to render the mitigation ineffective.

Prevalence in RubyGems community

2 packages
found in
Top 100
8 packages
found in
Top 1k
29 packages
found in
Top 10k
149 packages
in community

Next steps

In GCC, you can enable the stack canary with -fstack-protector-strong or -fstack-protector-all flag, but it may also be enabled by default in more recent versions of the compiler.
Consider upgrading your compiler.

Problem

On Linux, external symbols are resolved via the procedure linkage table (PLT) and the global offset table (GOT). Without any protection, both are writable at runtime and thus leave the executable vulnerable to pointer hijacking - an attack where the function address is overwritten with an address of a malicious function. Pointer hijacking can be mitigated by using full read-only relocations, which instruct the compiler to unify global offset tables into a single read-only table. This requires that all external function symbols are resolved at load-time instead of during execution, and may increase loading time for large programs.

Prevalence in RubyGems community

4 packages
found in
Top 100
14 packages
found in
Top 1k
106 packages
found in
Top 10k
712 packages
in community

Next steps

In most cases, it's recommended to use full read-only relocations (in GCC: -Wl,-z,relro,-z,now).
If the executable load-time is an issue, you should use partial read-only relocations.

Problem

Fortified functions are usually wrappers around standard glibc functions (such as memcpy) which perform boundary checks either at compile time or run time to determine if a memory violation has occurred. The compiler needs additional context to generate such calls (for example, array size that needs to be known at compile time). Because of this, the compiler will virtually never substitute all viable functions with their fortified counterparts in complex programs. However, lack of any fortified functions may indicate that this compiler feature was not used at all.

Prevalence in RubyGems community

2 packages
found in
Top 100
9 packages
found in
Top 1k
74 packages
found in
Top 10k
438 packages
in community

Next steps

In GCC, you can enable fortified functions with -D_FORTIFY_SOURCE=2 flag, while using at least -O1 optimization level.

Top behaviors

Prevalence in RubyGems community

Behavior often found in this community (Common)
41 packages
found in
Top 100
130 packages
found in
Top 1k
833 packages
found in
Top 10k
8732 packages
in community

Prevalence in RubyGems community

Behavior often found in this community (Common)
10 packages
found in
Top 100
49 packages
found in
Top 1k
260 packages
found in
Top 10k
1887 packages
in community

Prevalence in RubyGems community

Behavior often found in this community (Common)
45 packages
found in
Top 100
186 packages
found in
Top 1k
1704 packages
found in
Top 10k
18027 packages
in community

Prevalence in RubyGems community

Behavior often found in this community (Common)
34 packages
found in
Top 100
176 packages
found in
Top 1k
1207 packages
found in
Top 10k
13520 packages
in community

Prevalence in RubyGems community

Behavior often found in this community (Common)
72 packages
found in
Top 100
483 packages
found in
Top 1k
3269 packages
found in
Top 10k
37528 packages
in community

Top vulnerabilities

No vulnerabilities found.