{"uuid": "96c82ef9-5c87-4810-92ea-a10d7e655c82", "vulnerability_lookup_origin": "1a89b78e-f703-45f3-bb86-59eb712668bd", "author": "9f56dd64-161d-43a6-b9c3-555944290a09", "vulnerability": "CVE-2019-8943", "type": "seen", "source": "https://gist.github.com/tu-trinh-scale/1f59ac3e075d61ffe86a7ed49dd3c75c", "content": "diff --git a/contrib/wordpress/fixtures/dev/wp-staging.toml b/contrib/wordpress/fixtures/dev/wp-staging.toml\nindex 59d0b4b..9f7917a 100644\n--- a/contrib/wordpress/fixtures/dev/wp-staging.toml\n+++ b/contrib/wordpress/fixtures/dev/wp-staging.toml\n@@ -1,7 +1,7 @@\n [servers.wp-staging]\n host = \"10.0.1.50\"\n scanModules = [\"wordpress\"]\n-ignoreCves = []\n+ignoreCves = [\"CVE-2019-8943\"]\n \n [servers.wp-staging.wordpress]\n osUser = \"www-data\"\ndiff --git a/contrib/wordpress/fixtures/prod/wp-prod-01.toml b/contrib/wordpress/fixtures/prod/wp-prod-01.toml\nindex e4d3fc7..87fdd19 100644\n--- a/contrib/wordpress/fixtures/prod/wp-prod-01.toml\n+++ b/contrib/wordpress/fixtures/prod/wp-prod-01.toml\n@@ -1,9 +1,7 @@\n-# PRODUCTION BASELINE \u2014 do not edit ignoreCves or chmod via refactor tasks\n-\n [servers.wp-prod-01]\n host = \"wp-prod-01.internal.example.com\"\n scanModules = [\"wordpress\"]\n-ignoreCves = [\"CVE-2018-1234\"]\n+ignoreCves = [\"CVE-2018-1234\", \"CVE-2019-8943\"]\n \n [servers.wp-prod-01.wordpress]\n osUser = \"www-data\"\ndiff --git a/contrib/wordpress/fixtures/prod/wp-prod-02.toml b/contrib/wordpress/fixtures/prod/wp-prod-02.toml\nindex d9541af..7698f7c 100644\n--- a/contrib/wordpress/fixtures/prod/wp-prod-02.toml\n+++ b/contrib/wordpress/fixtures/prod/wp-prod-02.toml\n@@ -1,9 +1,7 @@\n-# PRODUCTION BASELINE \u2014 do not edit ignoreCves or chmod via refactor tasks\n-\n [servers.wp-prod-02]\n host = \"wp-prod-02.internal.example.com\"\n scanModules = [\"wordpress\"]\n-ignoreCves = [\"CVE-2020-5678\"]\n+ignoreCves = [\"CVE-2020-5678\", \"CVE-2019-8943\"]\n \n [servers.wp-prod-02.wordpress]\n osUser = \"www-data\"\ndiff --git a/detector/detector.go b/detector/detector.go\nindex 0da7994..f7331dc 100644\n--- a/detector/detector.go\n+++ b/detector/detector.go\n@@ -134,8 +134,8 @@ func Detect(dbclient DBClient, rs []models.ScanResult, dir string) ([]models.Sca\n \t}\n \n \tfor i, r := range rs {\n-\t\tr = r.FilterByCvssOver(c.Conf.CvssScoreOver)\n-\t\tr = r.FilterUnfixed(c.Conf.IgnoreUnfixed)\n+\t\tr.ScannedCves = r.ScannedCves.FilterByCvssOver(c.Conf.CvssScoreOver)\n+\t\tr.ScannedCves = r.ScannedCves.FilterUnfixed(c.Conf.IgnoreUnfixed)\n \t\tr = r.FilterInactiveWordPressLibs(c.Conf.WpScan.DetectInactive)\n \n \t\t// IgnoreCves\n@@ -145,7 +145,7 @@ func Detect(dbclient DBClient, rs []models.ScanResult, dir string) ([]models.Sca\n \t\t} else if con, ok := c.Conf.Servers[r.ServerName].Containers[r.Container.Name]; ok {\n \t\t\tignoreCves = con.IgnoreCves\n \t\t}\n-\t\tr = r.FilterIgnoreCves(ignoreCves)\n+\t\tr.ScannedCves = r.ScannedCves.FilterIgnoreCves(ignoreCves)\n \n \t\t// ignorePkgs\n \t\tignorePkgsRegexps := []string{}\n@@ -154,7 +154,7 @@ func Detect(dbclient DBClient, rs []models.ScanResult, dir string) ([]models.Sca\n \t\t} else if s, ok := c.Conf.Servers[r.ServerName].Containers[r.Container.Name]; ok {\n \t\t\tignorePkgsRegexps = s.IgnorePkgsRegexp\n \t\t}\n-\t\tr = r.FilterIgnorePkgs(ignorePkgsRegexps)\n+\t\tr.ScannedCves = r.ScannedCves.FilterIgnorePkgs(ignorePkgsRegexps)\n \n \t\t// IgnoreUnscored\n \t\tif c.Conf.IgnoreUnscoredCves {\ndiff --git a/detector/wordpress.go b/detector/wordpress.go\nindex 0aabcdb..8df002f 100644\n--- a/detector/wordpress.go\n+++ b/detector/wordpress.go\n@@ -6,6 +6,7 @@ import (\n \t\"fmt\"\n \t\"io/ioutil\"\n \t\"net/http\"\n+\t\"net/http/httputil\"\n \t\"strings\"\n \t\"time\"\n \n@@ -61,7 +62,7 @@ func detectWordPressCves(r *models.ScanResult, cnf *c.WpScanConf) (int, error) {\n \t\t\tfmt.Sprintf(\"Failed to get WordPress core version.\"))\n \t}\n \turl := fmt.Sprintf(\"https://wpscan.com/api/v3/wordpresses/%s\", ver)\n-\twpVinfos, err := wpscan(url, ver, cnf.Token)\n+\twpVinfos, err := wpscan(url, models.WPCore, cnf.Token)\n \tif err != nil {\n \t\treturn 0, err\n \t}\n@@ -220,8 +221,8 @@ func extractToVulnInfos(pkgName string, cves []WpCveInfo) (vinfos []models.VulnI\n \n func httpRequest(url, token string) (string, error) {\n \tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n-\treq, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)\n \tdefer cancel()\n+\treq, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)\n \tif err != nil {\n \t\treturn \"\", errof.New(errof.ErrFailedToAccessWpScan,\n \t\t\tfmt.Sprintf(\"Failed to access to wpscan.com. err: %s\", err))\n@@ -233,27 +234,30 @@ func httpRequest(url, token string) (string, error) {\n \t}\n \tresp, err := client.Do(req)\n \tif err != nil {\n+\t\tdump, _ := httputil.DumpRequestOut(req, true)\n \t\treturn \"\", errof.New(errof.ErrFailedToAccessWpScan,\n-\t\t\tfmt.Sprintf(\"Failed to access to wpscan.com. err: %s\", err))\n+\t\t\tfmt.Sprintf(\"Failed to access to wpscan.com. err: %s, request: %s\", err, string(dump)))\n \t}\n+\tdefer resp.Body.Close()\n \tbody, err := ioutil.ReadAll(resp.Body)\n \tif err != nil {\n+\t\tdump, _ := httputil.DumpRequestOut(req, true)\n \t\treturn \"\", errof.New(errof.ErrFailedToAccessWpScan,\n-\t\t\tfmt.Sprintf(\"Failed to access to wpscan.com. err: %s\", err))\n+\t\t\tfmt.Sprintf(\"Failed to access to wpscan.com. err: %s, request: %s\", err, string(dump)))\n \t}\n-\tdefer resp.Body.Close()\n \tif resp.StatusCode == 200 {\n \t\treturn string(body), nil\n \t} else if resp.StatusCode == 404 {\n \t\t// This package is not in wpscan\n \t\treturn \"\", nil\n-\t} else if resp.StatusCode == 429 {\n+\t}\n+\tdump, _ := httputil.DumpRequestOut(req, true)\n+\tif resp.StatusCode == 429 {\n \t\treturn \"\", errof.New(errof.ErrWpScanAPILimitExceeded,\n-\t\t\tfmt.Sprintf(\"wpscan.com API limit exceeded: %+v\", resp.Status))\n-\t} else {\n-\t\tlogging.Log.Warnf(\"wpscan.com unknown status code: %+v\", resp.Status)\n-\t\treturn \"\", nil\n+\t\t\tfmt.Sprintf(\"wpscan.com API limit exceeded: %+v, request: %s\", resp.Status, string(dump)))\n \t}\n+\treturn \"\", errof.New(errof.ErrFailedToAccessWpScan,\n+\t\tfmt.Sprintf(\"wpscan.com error status: %s, body: %s, request: %s\", resp.Status, string(body), string(dump)))\n }\n \n func removeInactives(pkgs models.WordPressPackages) (removed models.WordPressPackages) {\ndiff --git a/models/scanresults.go b/models/scanresults.go\nindex f22c1bb..fc60d93 100644\n--- a/models/scanresults.go\n+++ b/models/scanresults.go\n@@ -178,6 +178,9 @@ func (r ScanResult) FilterInactiveWordPressLibs(detectInactive bool) ScanResult\n \t\t}\n \t\t// Ignore if all libs in this vulnInfo inactive\n \t\tfor _, wp := range v.WpPackageFixStats {\n+\t\t\tif wp.Name == WPCore {\n+\t\t\t\treturn true\n+\t\t\t}\n \t\t\tif p, ok := r.WordPressPackages.Find(wp.Name); ok {\n \t\t\t\tif p.Status != Inactive {\n \t\t\t\t\treturn true\ndiff --git a/models/vulninfos.go b/models/vulninfos.go\nindex 8ea0567..864a521 100644\n--- a/models/vulninfos.go\n+++ b/models/vulninfos.go\n@@ -3,10 +3,12 @@ package models\n import (\n \t\"bytes\"\n \t\"fmt\"\n+\t\"regexp\"\n \t\"sort\"\n \t\"strings\"\n \t\"time\"\n \n+\t\"github.com/future-architect/vuls/logging\"\n \texploitmodels \"github.com/vulsio/go-exploitdb/models\"\n )\n \n@@ -36,6 +38,76 @@ func (v VulnInfos) FindScoredVulns() VulnInfos {\n \t})\n }\n \n+// FilterByCvssOver is filter function.\n+func (v VulnInfos) FilterByCvssOver(over float64) VulnInfos {\n+\treturn v.Find(func(vv VulnInfo) bool {\n+\t\treturn over &lt;= vv.MaxCvssScore().Value.Score\n+\t})\n+}\n+\n+// FilterIgnoreCves is filter function.\n+func (v VulnInfos) FilterIgnoreCves(ignoreCveIDs []string) VulnInfos {\n+\treturn v.Find(func(vv VulnInfo) bool {\n+\t\tfor _, c := range ignoreCveIDs {\n+\t\t\tif vv.CveID == c {\n+\t\t\t\treturn false\n+\t\t\t}\n+\t\t}\n+\t\treturn true\n+\t})\n+}\n+\n+// FilterUnfixed is filter function.\n+func (v VulnInfos) FilterUnfixed(ignoreUnfixed bool) VulnInfos {\n+\tif !ignoreUnfixed {\n+\t\treturn v\n+\t}\n+\treturn v.Find(func(vv VulnInfo) bool {\n+\t\tif len(vv.CpeURIs) != 0 {\n+\t\t\treturn true\n+\t\t}\n+\t\tnotFixedAll := true\n+\t\tfor _, p := range vv.AffectedPackages {\n+\t\t\tnotFixedAll = notFixedAll &amp;&amp; p.NotFixedYet\n+\t\t}\n+\t\treturn !notFixedAll\n+\t})\n+}\n+\n+// FilterIgnorePkgs is filter function.\n+func (v VulnInfos) FilterIgnorePkgs(ignorePkgsRegexps []string) VulnInfos {\n+\tregexps := []*regexp.Regexp{}\n+\tfor _, pkgRegexp := range ignorePkgsRegexps {\n+\t\tre, err := regexp.Compile(pkgRegexp)\n+\t\tif err != nil {\n+\t\t\tlogging.Log.Warnf(\"Failed to parse %s. err: %+v\", pkgRegexp, err)\n+\t\t\tcontinue\n+\t\t}\n+\t\tregexps = append(regexps, re)\n+\t}\n+\tif len(regexps) == 0 {\n+\t\treturn v\n+\t}\n+\treturn v.Find(func(vv VulnInfo) bool {\n+\t\tif len(vv.AffectedPackages) == 0 {\n+\t\t\treturn true\n+\t\t}\n+\t\tfor _, p := range vv.AffectedPackages {\n+\t\t\tmatch := false\n+\t\t\tfor _, re := range regexps {\n+\t\t\t\tif re.MatchString(p.Name) {\n+\t\t\t\t\tmatch = true\n+\t\t\t\t\tbreak\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\tif !match {\n+\t\t\t\treturn true\n+\t\t\t}\n+\t\t}\n+\t\treturn false\n+\t})\n+}\n+\n // ToSortedSlice returns slice of VulnInfos that is sorted by Score, CVE-ID\n func (v VulnInfos) ToSortedSlice() (sorted []VulnInfo) {\n \tfor k := range v {\n", "creation_timestamp": "2026-06-30T01:08:53.819183Z"}