-
-
Notifications
You must be signed in to change notification settings - Fork 621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PE: Possible invalid value for security_cookie #537
Comments
I looked at this issue. I used pefile as a reference since I have used it in the past In [1]: import pefile
In [2]: pe = pefile.PE("/tmp/cmd.exe")
In [3]: hex(pe.DIRECTORY_ENTRY_LOAD_CONFIG.struct.SecurityCookie)
Out[3]: '0x4ad33b78' pestudio says the file had Looking at this I looked at other implementations and libraries I have looked at in the past - package main
import (
"log"
peparser "github.com/saferwall/pe"
)
func main() {
filename := "/tmp/cmd.exe"
pe, err := peparser.New(filename, nil)
if err != nil {
log.Fatalf("Error while opening file: %s, reason: %v", filename, err)
}
err = pe.Parse()
if err != nil {
log.Fatalf("Error while parsing file: %s, reason: %v", filename, err)
}
log.Printf("%x\n", pe.LoadConfig.LoadCfgStruct.(peparser.ImageLoadConfigDirectory32v2).SecurityCookie)
} (test3) [petest] ./petest
2021/11/30 13:52:50 4ad33b78 I don't know what to use as a source of truth maybe @Wenzel can help? |
Also are you sure you ran winchecksec with this attached file? [build] ./winchecksec -j /tmp/cmd.exe | jq -r ".[].mitigations.gs.presence"
Present
[build] ./winchecksec /tmp/cmd.exe
Results for: /tmp/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 : "Present"
GS : "Present"
Authenticode : "NotPresent"
.NET : "NotPresent"
[build] md5sum /tmp/cmd.exe
eeb024f2c81f0d55936fb825d21a91d6 /tmp/cmd.exe |
I guess this is fixed now. |
Describe the bug
requesting the
load_configuration.security_cookie
can return an invalid value.To Reproduce
Steps to reproduce the behavior:
cmd.exe
(winxp executableExpected behavior
The issue is that
winchecksec
is telling me thatcmd.exe
doesn't have a stack cookie:And winchecksec GS check is implemented here, by verifying that the security cookie is
!= 0
.So, assuming that winchecksec is correct,
lief
should return0
and not1255357304
Environment (please complete the following information):
0.11.0-f58605f
but also reproductible with0.10.0
Thanks !
The text was updated successfully, but these errors were encountered: