Any Package Hunter related finding can be found on this dashboard (internal link).
We're going to use this finding as an example. In this finding, Package Hunter detected that a package opened a network connection.
02:24:56.163600570: Notice Disallowed outbound connection destination (command=node scripts/install.js connection=172.17.0.2:36884->52.217.109.44:443 user=root container_id=fb38d63ef02a container_name=some-container-eae8d3ec-a482-441b-8262-78198b46fdfb.tgz image=maldep)
@gitlab-com/gl-security/appsec
.
scripts/install.js
so we can search for that file (be sure to execute yarn install
before running the search)find . -name install.js
leads us to node_modules/node-sass/scripts/install.js
package.json
files to find the command that triggered the detection
node_modules/node-sass/package.json
that scripts/install.js
is indeed calledCompleting the investigation in the example, we see that the install.js
script
calls getBinaryURL()
. This function is defined in node_modules/node-sass/lib/extensions.js
:
/**
* Determine the URL to fetch binary file from.
* By default fetch from the node-sass distribution
* site on GitHub.
*/
function getBinaryUrl() {
var site = getArgument('--sass-binary-site') ||
process.env.SASS_BINARY_SITE ||
process.env.npm_config_sass_binary_site ||
(pkg.nodeSassConfig && pkg.nodeSassConfig.binarySite) ||
'https://github.com/sass/node-sass/releases/download'; return [site, 'v' + pkg.version, getBinaryName()].join('/');
}
We see from this file that node-sass
is trying to download the binary
from https://github.com/sass/node-sass/releases/download/VERSION/BINARY_NAME
Doing this locally we obtain:
$ wget https://github.com/sass/node-sass/releases/download/v5.0.0/linux-x64-64_binding.node
...
Connecting to github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)|52.216.204.107|:443... connected.
...
It's resolving the URL to 52.216.204.107, which is not exactly the same IP from the Package Hunter finding, but IP address info is very similar and it's normal that the request wouldn't exactly be served by the same IP every time in this context. At this point we can be reasonably sure about the source of the alert and that there is no malicious intent.