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

Image Docker - php:7.4.13-alpine with Bitcoin Miner #1110

Closed
eversdn1 opened this issue Jan 4, 2021 · 10 comments
Closed

Image Docker - php:7.4.13-alpine with Bitcoin Miner #1110

eversdn1 opened this issue Jan 4, 2021 · 10 comments
Labels
question Usability question, not directly related to an error with the image

Comments

@eversdn1
Copy link

eversdn1 commented Jan 4, 2021

After install a new clean server on aws e use this php:7.4.3-alpine image on my docker compose, after 30 minutes the cpu jump to 100%.
the synthoms and behavior is exact the same like this article.
https://www.linkedin.com/pulse/kinsing-malware-permanent-solution-amul-patel

Regards,
Everson Nunes

@JoelLinn
Copy link

JoelLinn commented Jan 4, 2021

Can you isolate this issue to one or at least a minimal set of components? How are you measuring the cpu usage (trying to rule out you misinterpret the steal time)

@eversdn1
Copy link
Author

eversdn1 commented Jan 4, 2021

Unfortunately it´s difficult to believe, but it´s simple, a new clean installation of the official php image are infected by a miner.
WhatsApp Image 2021-01-04 at 10 48 38.

@wglambert wglambert added the question Usability question, not directly related to an error with the image label Jan 4, 2021
@JoelLinn
Copy link

JoelLinn commented Jan 4, 2021

what are you running inside the php container? just the plain image or some other php software?

@wglambert
Copy link

Looks like that kdevtmpfsi is on the host system and not the container, what options are you running the container with?

Issues with kdevtmpfsi
redis/docker-library-redis#225
redis/docker-library-redis#217
docker-library/postgres#798 (comment)

This is an unfortunate consequence of having a public-facing instance with a compromised (or simple) password

@eversdn1
Copy link
Author

eversdn1 commented Jan 4, 2021

docker-compose file

version: '3.7'
services:
        nginx:
                container_name: nginx
                image: nginx:1.19.6-alpine
                restart: unless-stopped
                depends_on:
                     - php
                volumes:
                      - ./www:/www
                      - ./nginx.conf:/etc/nginx/conf.d/nginx.conf
                ports:
                      - "8000:8000"
                links:
                      - php
                networks:
                      - proxy

        php:
                container_name: php
                image: php:7.4.13-fpm-alpine
                restart: unless-stopped
                ports:
                      - "9000:9000"
                networks:
                      - proxy
networks:
  proxy:
     driver: bridge

what are you running inside the php container? just the plain image or some other php software?
I´m running just phpinfo.

Looks like that kdevtmpfsi is on the host system and not the container, what options are you running the container with?

Issues with kdevtmpfsi
docker-library/redis#225
docker-library/redis#217
docker-library/postgres#798 (comment)

This is an unfortunate consequence of having a public-facing instance with a compromised (or simple) password

wglambert - When the container is stopped the kdevtmpfsi stopped to. Now i´m running 7.3.25 php image and the problem are solved.

@tianon
Copy link
Member

tianon commented Jan 4, 2021

You definitely don't want to expose PHP-FPM to the public internet -- you want it in the same Docker Network as NGINX so NGINX can access it, but nothing else (drop the 9000:9000 from the php service definition).

I'm certain there are all sorts of nasty things an attacker could do with a public FPM instance. 😱 😞

@eversdn1
Copy link
Author

eversdn1 commented Jan 4, 2021

Thanks for all feedback.
I will close 9000 port of php-fpm and create a new server. Let´s wait and monitor to see.

Printscreen - top command on container php.
image

@JoelLinn
Copy link

Probably should be closed by now

@eversdn1
Copy link
Author

eversdn1 commented Feb 10, 2021 via email

@hakuno
Copy link

hakuno commented Feb 11, 2021

Is it enough? I'm unsure.

You can close the listening port (incoming). But it may have some outgoing connection.

ps. also known as reverse connection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Usability question, not directly related to an error with the image
Projects
None yet
Development

No branches or pull requests

6 participants