Skip to content
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

Code Security Report: 16 high severity findings, 22 total findings [main] #410

Open
1 task
mend-for-github-com bot opened this issue Jan 13, 2025 · 0 comments
Open
1 task
Labels
Mend: code security findings Code security findings detected by Mend

Comments

@mend-for-github-com
Copy link
Contributor

mend-for-github-com bot commented Jan 13, 2025

Code Security Report

Scan Metadata

Latest Scan: 2025-02-26 03:25pm
Total Findings: 22 | New Findings: 0 | Resolved Findings: 0
Tested Project Files: 138
Detected Programming Languages: 2 (Go, Python)

  • Check this box to manually trigger a scan

Most Relevant Findings

The list below presents the 10 most relevant findings that need your attention. To view information on the remaining findings, navigate to the Mend Application.

SeverityVulnerability TypeCWEFileData FlowsDetected
HighFile Manipulation

CWE-73

block_cache_linux.go:979

12024-09-13 04:56pm
Vulnerable Code

}
// Dump this block to local disk cache
f, err := os.Create(localPath)
if err == nil {
_, err := f.Write(item.block.data[:n])

1 Data Flow/s detected

f, err := os.Open(localPath)

n, err := f.Read(item.block.data)

_, err := f.Write(item.block.data[:n])

Secure Code Warrior Training Material

● Training

   ▪ Secure Code Warrior File Manipulation Training

● Videos

   ▪ Secure Code Warrior File Manipulation Video

● Further Reading

   ▪ OWASP Path Traversal

   ▪ OWASP Input Validation Cheat Sheet

 
HighInsecure Directory Permissions

CWE-732

mount_all.go:343

12024-04-02 02:23pm
Vulnerable Code

cloudfuse/cmd/mount_all.go

Lines 338 to 343 in 90e2ef9

if options.SecureConfig {
contConfigFile = contConfigFile + SecureConfigExtension
}
if _, err := os.Stat(contMountPath); os.IsNotExist(err) {
err = os.MkdirAll(contMountPath, 0777)

1 Data Flow/s detected

err = os.MkdirAll(contMountPath, 0777)

Secure Code Warrior Training Material
 
HighPath/Directory Traversal

CWE-22

write.py:16

22025-01-15 03:31pm
Vulnerable Code

bytes_written = 0
data = os.urandom(blockSize)
t1 = time.time()
fd = open(os.path.join(mountpath, 'application_'+size+'.data'), 'wb')

2 Data Flow/s detected
View Data Flow 1

size = sys.argv[2]

View Data Flow 2

mountpath = sys.argv[1]

Secure Code Warrior Training Material

● Training

   ▪ Secure Code Warrior Path/Directory Traversal Training

● Videos

   ▪ Secure Code Warrior Path/Directory Traversal Video

● Further Reading

   ▪ OWASP Path Traversal

   ▪ OWASP Input Validation Cheat Sheet

 
HighFile Manipulation

CWE-73

block_cache_linux.go:1689

12024-04-02 02:23pm
Vulnerable Code

localDstPath := filepath.Join(bc.tmpPath, options.Dst)
files, err := filepath.Glob(localSrcPath + "*")
if err == nil {
for _, f := range files {
err = os.Rename(f, strings.Replace(f, localSrcPath, localDstPath, 1))

1 Data Flow/s detected

f, err := os.Open(localPath)

Secure Code Warrior Training Material

● Training

   ▪ Secure Code Warrior File Manipulation Training

● Videos

   ▪ Secure Code Warrior File Manipulation Video

● Further Reading

   ▪ OWASP Path Traversal

   ▪ OWASP Input Validation Cheat Sheet

 
HighInsecure Directory Permissions

CWE-732

block_cache_linux.go:970

12025-01-14 09:10pm
Vulnerable Code

}
item.block.endIndex = item.block.offset + uint64(n)
if bc.tmpPath != "" {
err := os.MkdirAll(filepath.Dir(localPath), 0755)

1 Data Flow/s detected

err := os.MkdirAll(filepath.Dir(localPath), 0755)

Secure Code Warrior Training Material
 
HighInsecure File Permissions

CWE-732

journal.go:57

12025-01-23 05:07pm
Vulnerable Code

err := common.CreateDefaultDirectory()
if err != nil {
return nil, fmt.Errorf("Failed to create default work dir [%s]", err.Error())
}
f, err := os.OpenFile(journalFile, os.O_CREATE|os.O_RDWR, 0644)

1 Data Flow/s detected

f, err := os.OpenFile(journalFile, os.O_CREATE|os.O_RDWR, 0644)

Secure Code Warrior Training Material
 
HighCommand Injection

CWE-78

mount_all.go:377

12024-04-02 02:23pm
Vulnerable Code

cloudfuse/cmd/mount_all.go

Lines 372 to 377 in 90e2ef9

updateCliParams(&cliParams, "tmp-path", filepath.Join(fileCachePath, container))
}
// Now that we have mount path and config file for this container fire a mount command for this one
fmt.Println("Mounting container :", container, "to path ", contMountPath)
cmd := exec.Command(mountAllOpts.cloudfuseBinPath, cliParams...)

1 Data Flow/s detected

mountAllOpts.cloudfuseBinPath = os.Args[0]

Secure Code Warrior Training Material

● Training

   ▪ Secure Code Warrior Command Injection Training

● Videos

   ▪ Secure Code Warrior Command Injection Video

● Further Reading

   ▪ OWASP testing for Command Injection

   ▪ OWASP Command Injection

 
HighInsecure File Permissions

CWE-732

base_logger.go:186

12024-04-02 02:23pm
Vulnerable Code

fi, e := os.Stat(l.fileConfig.LogFile)
if e == nil {
l.fileConfig.currentLogSize = uint64(fi.Size())
}
var err error
l.logFileHandle, err = os.OpenFile(l.fileConfig.LogFile, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644)

1 Data Flow/s detected

l.logFileHandle, err = os.OpenFile(l.fileConfig.LogFile, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644)

Secure Code Warrior Training Material
 
HighInsecure File Permissions

CWE-732

stats_export.go:278

12025-01-14 09:10pm
Vulnerable Code

fname = fmt.Sprintf("%v_%v.%v", baseName, hmcommon.Pid, hmcommon.OutputFileExtension)
fnameNew = fmt.Sprintf("%v_%v_1.%v", baseName, hmcommon.Pid, hmcommon.OutputFileExtension)
_ = os.Rename(fname, fnameNew)
fname = fmt.Sprintf("%v_%v.%v", baseName, hmcommon.Pid, hmcommon.OutputFileExtension)
se.opFile, err = os.OpenFile(fname, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)

1 Data Flow/s detected

se.opFile, err = os.OpenFile(fname, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)

Secure Code Warrior Training Material
 
HighFile Manipulation

CWE-73

service_windows.go:102

12024-04-02 02:23pm
Vulnerable Code

SuggestFor: []string{"uninst", "uninstal"},
Example: "cloudfuse service uninstall",
FlagErrorHandling: cobra.ExitOnError,
RunE: func(cmd *cobra.Command, args []string) error {
startupPath := filepath.Join(os.Getenv("APPDATA"), "Microsoft", "Windows", "Start Menu", "Programs", "Startup", StartupName)
err := os.Remove(startupPath)

1 Data Flow/s detected

startupPath := filepath.Join(os.Getenv("APPDATA"), "Microsoft", "Windows", "Start Menu", "Programs", "Startup", StartupName)

Secure Code Warrior Training Material

● Training

   ▪ Secure Code Warrior File Manipulation Training

● Videos

   ▪ Secure Code Warrior File Manipulation Video

● Further Reading

   ▪ OWASP Path Traversal

   ▪ OWASP Input Validation Cheat Sheet

Findings Overview

Severity Vulnerability Type CWE Language Count
High Command Injection CWE-78 Go 1
High File Manipulation CWE-73 Go 4
High Path/Directory Traversal CWE-22 Python 2
High Insecure Directory Permissions CWE-732 Go 3
High Insecure File Permissions CWE-732 Go 6
Medium Heap Inspection CWE-244 Go 5
Low Weak Hash Strength CWE-916 Go 1
@mend-for-github-com mend-for-github-com bot added the Mend: code security findings Code security findings detected by Mend label Jan 13, 2025
@mend-for-github-com mend-for-github-com bot changed the title Code Security Report: 18 high severity findings, 26 total findings [main] Code Security Report: 15 high severity findings, 23 total findings [main] Jan 15, 2025
@mend-for-github-com mend-for-github-com bot changed the title Code Security Report: 15 high severity findings, 23 total findings [main] Code Security Report: 16 high severity findings, 24 total findings [main] Jan 29, 2025
@mend-for-github-com mend-for-github-com bot changed the title Code Security Report: 16 high severity findings, 24 total findings [main] Code Security Report: 16 high severity findings, 25 total findings [main] Feb 4, 2025
@mend-for-github-com mend-for-github-com bot changed the title Code Security Report: 16 high severity findings, 25 total findings [main] Code Security Report: 16 high severity findings, 22 total findings [main] Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mend: code security findings Code security findings detected by Mend
Projects
None yet
Development

No branches or pull requests

0 participants