Skip to content

CVE-2024-5129 #16

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

CVE-2024-5129 #16

wants to merge 7 commits into from

Conversation

lmkoduru
Copy link

No description provided.

Copy link
Collaborator

@olegbck olegbck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exploit seems to be working, but could you please add another command after curl, that would prove that the 'lunary' database was indeed deleted?


- name: Install nvm
ansible.builtin.shell: >
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.39.1/install.sh | bash
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need exactly 0.39.1? If we do, please move this file to the data folder, do not pull it by URL. Otherwise use https://raw.githubusercontent.com/creationix/nvm/master/install.sh

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, we don't need the specific version. I've just changed it to use https://raw.githubusercontent.com/creationix/nvm/master/install.sh

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've also added another command after curl that shows we deleted the database


- name: Install node and project deps
shell: >
. $HOME/.nvm/nvm.sh && nvm install 20.18.0 && cd /tmp/lunary && npm install && npm run migrate:db
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does "nvm install 20.18.0" pull something from the Internet? Is it possible to keep this version of that thing in the data folder? Imagine 20.18.0 is not available anymore for download. What do we do?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a version in the data folder

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I meant is: please not only put the archive to the data folder, but also install it from the file. My mistake, sorry if it wasn't obvious.

@olegbck
Copy link
Collaborator

olegbck commented Nov 21, 2024

Still waiting for node-v20.18.0-darwin-x64.tar.gz to be used during installation, then I'll test the changes

@lmkoduru
Copy link
Author

lmkoduru commented Dec 5, 2024

Hi Oleg,
I just updated the code to use node-v20.18.0-darwin-x64.tar.gz during installation. Please let me know if it looks ok or if I should modify anything.

@olegbck
Copy link
Collaborator

olegbck commented Dec 5, 2024

It fails at this stage:

024-12-05 08:20:22,435 - INFO - [ubuntu1] TASK [Install node and project deps] *******************************************
2024-12-05 08:20:24,388 - INFO - [ubuntu1] fatal: [ubuntu1]: FAILED! => {"changed": true, "cmd": "export NODE_PATH=/desired/install/path/node-v20.18.0-darwin-x64 && export PATH=$NODE_PATH/bin:$PATH && cd /tmp/lunary && npm install && npm run migrate:db\n", "delta": "0:00:00.038004", "end": "2024-12-05 07:20:23.364126", "msg": "non-zero return code", "rc": 127, "start": "2024-12-05 07:20:23.326122", "stderr": "/bin/bash: line 1: npm: command not found", "stderr_lines": ["/bin/bash: line 1: npm: command not found"], "stdout": "", "stdout_lines": []}

@lmkoduru
Copy link
Author

lmkoduru commented Dec 5, 2024

Hi Oleg,
Does the latest code seem to work?

export NODE_PATH=/desired/install/path/node-v20.18.0-darwin-x64 &&
export PATH=$NODE_PATH/bin:$PATH &&
cd /tmp &&
curl -O https://nodejs.org/dist/v20.18.0/node-v20.18.0-darwin-x64.tar.gz &&
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not pull this package from the Internet. It's already in the data folder, please install it from the file.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just made some changes, does it look ok?

@olegbck
Copy link
Collaborator

olegbck commented Dec 6, 2024

This variant still doesn't work:

2024-12-06 12:06:12,197 - INFO - [ubuntu1] TASK [Install node and project deps] *******************************************
2024-12-06 12:06:12,814 - INFO - [ubuntu1] fatal: [ubuntu1]: FAILED! => {"changed": true, "cmd": "tar -xzf data/node-v20.18.0-darwin-x64.tar.gz -C /usr/local && export PATH=/usr/local/node-v20.18.0-darwin-x64/bin:$PATH && npm install && npm run migrate:db\n", "delta": "0:00:00.045951", "end": "2024-12-06 11:06:11.648362", "msg": "non-zero return code", "rc": 2, "start": "2024-12-06 11:06:11.602411", "stderr": "tar (child): data/node-v20.18.0-darwin-x64.tar.gz: Cannot open: No such file or directory\ntar (child): Error is not recoverable: exiting now\ntar: Child returned status 2\ntar: Error is not recoverable: exiting now", "stderr_lines": ["tar (child): data/node-v20.18.0-darwin-x64.tar.gz: Cannot open: No such file or directory", "tar (child): Error is not recoverable: exiting now", "tar: Child returned status 2", "tar: Error is not recoverable: exiting now"], "stdout": "", "stdout_lines": []}

Could you please test your changes before commiting them?

@olegbck
Copy link
Collaborator

olegbck commented Jan 7, 2025

The error message above can't find node-v20.18.0-darwin-x64.tar.gz because it hasn't been copied to ubuntu1. This file is only 112 bytes in size, and "darwin" in the name implies that the archive targets MacOS (we need the one for Ubuntu). I tried to use https://nodejs.org/dist/v20.18.0/node-v20.18.0-linux-x64.tar.xz from https://nodejs.org/en/blog/release/v20.18.0, but I still get these errors:

$ sudo npm install
npm error code ENOENT
npm error syscall open
npm error path /home/vagrant/package.json
npm error errno -2
npm error enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/home/vagrant/package.json'
npm error enoent This is related to npm not being able to find a file.
npm error enoent
npm error A complete log of this run can be found in: /root/.npm/_logs/2025-01-07T13_18_07_334Z-debug-0.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants