Skip to content

Commit bd3184f

Browse files
committed
Find PV signature in any section
1 parent 74ae725 commit bd3184f

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

lib/HasPolyverseTaint.go

+12-17
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,17 @@ func HasPolyverseTaint(path string) (bool, error) {
3939
return false, errors.Wrapf(err, "Unable to open ELF file at path %s", path)
4040
}
4141
defer elfFile.Close()
42-
43-
comment := elfFile.Section(".comment")
44-
if comment == nil {
45-
log.Debugf("File %s has no comment section. Thus it is not Polyverse tainted", path)
46-
return false, nil
47-
}
48-
49-
commentData, err := comment.Data()
50-
if err != nil {
51-
return false, errors.Wrapf(err, "Unable to read .comment section data from ELF file at path %s", path)
52-
}
53-
54-
commentStr := string(commentData)
55-
if strings.Contains(commentStr, constants.PolyverseSignature) {
56-
return true, nil
57-
}
58-
log.Debugf("File %s is not Polyverse tainted in the .comment section", path)
42+
43+
for _, section := range elfFile.Sections {
44+
sectionData, err := section.Data()
45+
if err != nil {
46+
continue
47+
}
48+
sectionStr := string(sectionData)
49+
if strings.Contains(sectionStr, constants.PolyverseSignature) {
50+
return true, nil
51+
}
52+
}
53+
log.Debugf("File %s is not Polyverse tainted", path)
5954
return false, nil
6055
}

0 commit comments

Comments
 (0)