Skip to content

PE: Possible invalid value for security_cookie #537

@Wenzel

Description

@Wenzel

Describe the bug
requesting the load_configuration.security_cookie can return an invalid value.

To Reproduce
Steps to reproduce the behavior:

  • download cmd.zip and uncompress it to get cmd.exe (winxp executable
  • load it with lief in python
  • get the security cookie
In [1]: import lief

In [2]: pe = lief.parse("/home/wenzel/local/cmd.exe")
Unable to find the section associated with BOUND_IMPORT

In [3]: pe.load_configuration.security_cookie
Out[3]: 1255357304

Expected behavior
The issue is that winchecksec is telling me that cmd.exe doesn't have a stack cookie:

$ winchecksec cmd.exe
Dynamic Base    : "NotPresent"
ASLR            : "NotPresent"
High Entropy VA : "NotPresent"
Force Integrity : "NotPresent"
Isolation       : "Present"
NX              : "NotPresent"
SEH             : "Present"
CFG             : "NotPresent"
RFG             : "NotPresent"
SafeSEH         : "NotPresent"
GS              : "NotPresent"
Authenticode    : "NotPresent"
.NET            : "NotPresent"

And winchecksec GS check is implemented here, by verifying that the security cookie is != 0.
So, assuming that winchecksec is correct, lief should return 0 and not 1255357304

Environment (please complete the following information):

  • System and Version : Ubuntu 20.04
  • Target format PE
  • LIEF commit version: 0.11.0-f58605f but also reproductible with 0.10.0

Thanks !

Metadata

Metadata

Assignees

Labels

Good First IssueIssue that can be addressed without an in-depth understanding of LIEF

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions