runtime icon indicating copy to clipboard operation
runtime copied to clipboard

BinSkim BA2021 on System.Private.CoreLib.dll

Open ravimeda opened this issue 9 years ago • 3 comments

Repro steps:

  1. Build CoreCLR (build.cmd)
  2. Run BinSkim (https://github.com/Microsoft/binskim/blob/master/README.md#for-users)

Expected: No issues

Actual: Defect Id BA2021 is reported on System.Private.CoreLib.dll

Details: PE sections should not be marked as both writable and executable. This condition makes it easier for an attacker to exploit memory corruption vulnerabilities, as it may provide an attacker executable location(s) to inject shellcode. To resolve this issue, configure your tools to not emit memory sections that are writable and executable. For example, look for uses of /SECTION on the linker command line for C and C++ programs, or #pragma section in C and C++ source code, which mark a section with both attributes. Be sure to disable incremental linking in release builds, as this feature creates a writable and executable section named '.textbss' in order to function.'System.Private.CoreLib.dll' contains PE section(s) (.xdata) that are both writable and executable. Writable and executable memory segments make it easier for an attacker to exploit memory corruption vulnerabilities, because it may provide an attacker executable location(s) to inject shellcode. To resolve this issue, configure your tools to not emit memory sections that are writable and executable. For example, look for uses of /SECTION on the linker command line for C and C++ programs, or #pragma section in C and C++ source code, which mark a section with both attributes. Enabling incremental linking via the /INCREMENTAL argument (the default for Microsoft Visual Studio debug build) can also result in a writable and executable section named 'textbss'. For this case, disable incremental linking (or analyze an alternate build configuration that disables this feature) to resolve the problem.

ravimeda avatar Nov 22 '17 22:11 ravimeda

cc @vitek-karas

jkotas avatar Nov 22 '17 22:11 jkotas

@vitek-karas Do you expect 2.1 System.Private.CoreLib to pass BinSkim, which I expect requires no write-execute sections in the image? If not, could you move this to Future?

@jeffschwMSFT

RussKeldorph avatar Mar 28 '18 15:03 RussKeldorph

Fragile ngen support has been deleted.

jkotas avatar Oct 20 '22 23:10 jkotas