Skip to main content

Insecure file upload - DLL Injection

Description

The application does not properly validate the DLL files, allowing the injection of malicious DLLS

Impact

Inject backdoors, virus, or other types of malicious files into the application

Recommendation

  • Verify with an antivirus that the imported DLLs do not contain virus, backdoors or potentially harmful information
  • Define a white-list of allowed DLLs and their respective integrity hashes

Threat

Anonymous attacker from local machine

Expected Remediation Time

⌚ 20 minutes.

Score

Default score using CVSS 3.1. It may change depending on the context of the vulnerability.

Base

  • Attack vector: L
  • Attack complexity: L
  • Privileges required: N
  • User interaction: N
  • Scope: U
  • Confidentiality: N
  • Integrity: L
  • Availability: N

Temporal

  • Exploit code madurity: P
  • Remediation level: U
  • Report confidence: C

Result

  • Vector string: CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N/E:P/RL:U/RC:C
  • Score:
    • Base: 4.0
    • Temporal: 3.8
  • Severity:
    • Base: Medium
    • Temporal: Low

Code Examples

Compliant code

The application performs server side validation for all inputs

using System;
using System.Reflection;
public partial class WebForm : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
string input = Request.Form["in"];
string cleanInput = clearRawUserInput(input);
byte[] rawAssembly = Convert.FromBase64String(cleanInput);
Assembly.Load(rawAssembly);
}
}

Non compliant code

The application does not verify on the server side the inputs before a file upload

using System;
using System.Reflection;
public partial class WebForm : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
string input = Request.Form["in"];
byte[] rawAssembly = Convert.FromBase64String(input);
Assembly.Load(rawAssembly);
}
}

Requirements

free trial

Search for vulnerabilities in your apps for free with our automated security testing! Start your 21-day free trial and discover the benefits of our Continuous Hacking Machine Plan. If you prefer a full service that includes the expertise of our ethical hackers, don't hesitate to contact us for our Continuous Hacking Squad Plan.