Rust

Rust

Made by DeepSource
Potentially unsafe usage of Arc::get_mut RS-S1000
Security
Minor

In the standard library in Rust before 1.29.0, there is weak synchronization in the Arc::get_mut method. This synchronization issue can be lead to memory safety issues through race conditions.

Manual implementation of Error::type_id RS-S1001
Security
Major

Manual implementations of Error::type_id can cause memory unsafety. Overriding the default implementation of Error::type_id can violate Rust's safety guarantees.

Detected conversion between differently sized raw slices RS-S1013
Security
Major

Conversion between raw slices of differently sized types is undefined behaviour, because the length of the pointer is not converted using as.

Insufficient RSA key size RS-S1005
Security
Major

The strength of public-key-based cryptographic algorithm (like RSA) is determined by the time that it takes to derive the private key by using brute-force methods. 1024-bit keys are to be avoided since they are easy to brute-force. However, 2048-bit keys are said to be sufficient until 2030. Preferably use 4096-bit keys.

Missing regex anchor RS-S1008
Security
Major

It is unsafe to match untrusted input against regular expressions without ^ anchor. URLs with missing anchors can prove fatal as malicious inputs bypass the system's security checks.

Hardcoded temporary file or directory detected RS-S1003
Security
Major

This issue is raised when a hardcoded temporary file or directory is detected. Creating and using insecure temporary files can leave the application vulnerable to attacks. Lack of uniqueness in temporary files allows attackers to predict the filename and inject dangerous data into the application through the temporary file.

Found usage of cryptographically insecure algorithm RS-S1004
Security
Major

Certain cryptographic algorithms are known to be cryptographically insecure and should be avoided.

Found potentially incorrect use of bitwise XOR RS-S1007
Security
Major
Autofix

The caret symbol (^) in some languages is used to represent exponentiation. However, in Rust, as in many C-like languages, it represents the bitwise exclusive-or (XOR) operation. It is recommended to carefully vet if the caret is being used for XOR or exponentiation.

Potentially unsafe usage of std::fs::remove_dir_all RS-S1002
Security
Major

In the standard library in Rust before 1.58.1, there is a race condition that enables symlink following. An attacker could take advantage of this security vulnerability to trick a privileged program into deleting files and directories the attacker couldn't otherwise access or delete.

Detected conversion of *const to *mut RS-S1011
Security
Major

Converting *const to *mut works in safe code. However, mutating such a pointer can result in undefined behavior. Such situations can only occur in unsafe code, because dereferencing pointers is an unsafe operation.

Detected conversion of raw slice to ptr RS-S1012
Security
Major

Conversion from a raw slice to ptr results in undefined behavior.

Consider using the following conversion methods:

  • std::ptr::slice_from_raw_parts to convert a ptr and len pair into a raw slice
  • std::slice::as_ptr to convert a raw slice to a ptr
File or directory created with insecure permissions RS-A1001
Security
Critical

Excessive permissions are granted to a file or directory. This issue is raised when a permission mode greater than 0o755 is given.

Audit required: Use of VecDeque::make_contiguous RS-A1005
Security
Major

In the standard library in Rust before 1.49.0, VecDeque::make_contiguous has a bug that pops the same element more than once under certain condition. This bug could result in a use-after-free or double free.

Audit required: Exposure of sensitive headers RS-A1004
Security
Major

Use of headers such as "Server", "X-Powered-By" and "X-AspNet-Version" can leak sensitive information of your application and server. Avoid using these headers if possible.

Audit required: Use of Vec::from_iter RS-A1006
Security
Major

In the standard library in Rust before 1.52.0, a double free can occur in the Vec::from_iter function if freeing the element panics.

Detected invisible unicode character RS-S1010
Security
Major

The presence of invisible Unicode characters can lead to various vulnerabilities that may be hard to detect with a simple code review. Consider revisiting this line of code.

Detected non-octal Unix permissions RS-E1013
Security
Critical

Using non-octal values to set Unix file permissions can result in unintended file permissions.

Bind to all interfaces RS-S1006
Security
Major

Binding to all network interfaces can potentially open up a service to traffic on unintended interfaces.