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

Hagana self-authorize break out #14

Open
Mickael-van-der-Beek opened this issue Jul 15, 2022 · 3 comments
Open

Hagana self-authorize break out #14

Mickael-van-der-Beek opened this issue Jul 15, 2022 · 3 comments

Comments

@Mickael-van-der-Beek
Copy link

Since Hagana is available to the other node_modules, it's possible to call Hagana inside the malicious module to self-authorise the wanted actions.

e.g: the malicious library code:

import fs from 'fs';
import path from 'path';
import hagana from '@hagana/hagana';

export function run () {
  const fileDirectory = path.resolve(path.dirname('.'), '..');
  const filePath = path.resolve(fileDirectory, './out.txt');
  hagana.setRoot(fileDirectory);
  fs.writeFileSync(filePath, 'yolooo', { encoding: 'utf-8' });
}
@yaakov123
Copy link
Owner

🤦🏻‍♂️ This is a good find. I guess the only way to solve this is by maintaining internal state to know that hagana has already been required and then prevent additional requires.

Need to think about this.

@Mickael-van-der-Beek
Copy link
Author

I would probably block any calls to Hagana coming from the library directory outside of Hagana's directory itself.

@yaakov123
Copy link
Owner

That's a better idea.

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

No branches or pull requests

2 participants