hacker-scripts icon indicating copy to clipboard operation
hacker-scripts copied to clipboard

Password in Source Code

Open gszathmari opened this issue 8 years ago • 27 comments

The password for the coffee machine is stored in the source code, which is 1234: https://github.com/NARKOZ/hacker-scripts/blob/master/fucking_coffee.rb#L12

This could allow anyone with access to the source code to access the coffee machine on the network.

Please remove the password from the source code into an environmental variable, and rotate the credentials on the coffee machine immediately.

gszathmari avatar Nov 26 '15 11:11 gszathmari

OK,but I don't know how to make it;can you tell me ?

chitianfarmer avatar Nov 26 '15 11:11 chitianfarmer

What I recommend is a full fledged code review scanning for security issues. Please feel free to contact me in private for a short discussion, so I can understand your requirements better. After that, I will provide you a quote for my services along with the draft of the contract.

gszathmari avatar Nov 26 '15 11:11 gszathmari

THIS ASSHOLE CHARGED MY FUCKIN CARD WITHOUT MY AUTHORIZATION, I'M OPTING OUT. CAN'T TRUST THIS PEOPLE.

junbugg avatar Nov 26 '15 11:11 junbugg

Hey, Just replace the password with an environment placeholder for the production workspace and mention in the README to update the placeholder with the password. In this way hardcoding the passwords can be avoided. Alternatively, encrypting the text is another option. However, this can be dangerous if a weak encryption is being used. Environmental variable is something like this :-
TWILIO_ACCOUNT_SID = ENV['TWILIO_ACCOUNT_SID']

In the above example, TWILIO accound SID was being protected.

In the same way, the code in this case can be modified as password = ENV['Password_of_the_machine'] coffee_machine_ip =ENV['Coffee_Machine_IP'] password_prompt = ENV['PASSWORD'] Reach out to me if you'd like to know more about this issue :) I'd be happy to help.

Best.

pbssubhash avatar Nov 26 '15 12:11 pbssubhash

How about if we switch to a microservices architecture and store the password in a config service instead?

On 26 Nov 2015, at 12:00, P B Surya Subhash [email protected] wrote:

Hey, Just replace the password with an environment placeholder for the production workspace and mention in the README to update the placeholder with the password. In this way hardcoding the passwords can be avoided. Alternatively, encrypting the text is another option. However, this can be dangerous if a weak encryption is being used.

Reach out to me if you'd like to know more about this issue :) I'd be happy to help.

Best.

— Reply to this email directly or view it on GitHub https://github.com/NARKOZ/hacker-scripts/issues/42#issuecomment-159895256.

gszathmari avatar Nov 26 '15 12:11 gszathmari

Yeah, authenticating using a dynamically assigned gateway is a decent option.

pbssubhash avatar Nov 26 '15 12:11 pbssubhash

Also, the Internal IP Address must be removed. Again, even in the Python module,these must be changed. https://github.com/NARKOZ/hacker-scripts/blob/master/python3/fucking_coffee.py#L10 https://github.com/NARKOZ/hacker-scripts/blob/master/python3/fucking_coffee.py#L11

pbssubhash avatar Nov 26 '15 12:11 pbssubhash

I think moving authentication to Vault (https://github.com/hashicorp/vault) would be better approach

rusenask avatar Nov 26 '15 21:11 rusenask

Hold on your horses, @rusenask, we have plenty of suggestions here. I think we should form a committee and let it decide what the best option is.

gszathmari avatar Nov 26 '15 21:11 gszathmari

Could we ssh into the coffee machine, instead ?

bitsapien avatar Nov 28 '15 20:11 bitsapien

Good point as telnet is connecting in clear text

Regards, Gabor

On 28 Nov 2015, at 20:07, C Rahul [email protected] wrote:

Could we ssh into the coffee machine, instead ?

— Reply to this email directly or view it on GitHub.

gszathmari avatar Nov 28 '15 23:11 gszathmari

Let's also consider another, much more sophisticated approach - what if we could create a separate web service that would just be handling coffee machine (like a micro service that would be used by management script)? This way we could also have separate modules for different coffee machine models. It could also have better security, web UI (if needed), statistics, OAuth. What do you think, guys?

rusenask avatar Nov 28 '15 23:11 rusenask

Security for coffeemachines is indeed very important, otherwise you might get a CoffeeOverflowError on the floor if someone is hacking the coffemachine

danielr1996 avatar Nov 28 '15 23:11 danielr1996

How about store these password and internet address to a ini file? What's inside is like : Internet address : xxx.xxx.xxx.xxx username : xxxxx password: xxxxx

yueyangming avatar Nov 30 '15 02:11 yueyangming

In fact that would be the same, adding to some config file won't make any difference for the attacker. He'll steal it either way. And if the ini file is added to .gitignore, its fine. But then again it's not the best practice. Sent from my iPhone

_____________________________

From: Yangming Yue [email protected] Sent: Monday, November 30, 2015 7:45 AM Subject: Re: [hacker-scripts] Password in Source Code (#42) To: NARKOZ/hacker-scripts [email protected] Cc: P B Surya Subhash [email protected]

How about store these password and internet address to a ini file? What's inside is like : Internet address : xxx.xxx.xxx.xxx username : xxxxx password: xxxxx

— Reply to this email directly or view it on GitHub.

pbssubhash avatar Nov 30 '15 02:11 pbssubhash

I think we can go even bigger guys.

Think "Billion People" sized solutions.

It's unfortunate the original implementation deviates a little from the twelve factor app.

I'm also having to hold off on deploying my copy pasta implementation of this system to production because dev/ops won't sanction it.

It's surprising a system written by such a lauded hacker doesn't come preconfigured to work in ether my NixOS build system, nor is there much compatibility with Otto.

Signed, CoffeeTurb Inc LLC org Entitled Non Paying Enterprise User

elrikdante avatar Nov 30 '15 18:11 elrikdante

It's powershell: use ConvertTo-SecureString? :P

juliusdedekind avatar Dec 03 '15 07:12 juliusdedekind

Coffe machines must be telnet like which is a very plain text protocol and it's compatible with all interfaces. The real need is to incorporate on any corporation machine the coffee-service. Just a way to custom and serve your coffee, with a hardware anti-coffee-overflows, ready near the desk. This guy is really genious. LOL

ghost avatar Dec 15 '15 01:12 ghost

The password is 1234, Damn. Not even a min needed for bruteing it or using a dictionary or something :3 :-1:

regalstreak avatar Feb 19 '16 14:02 regalstreak

"What are you doing?" "Shbang! I hacked the coffee machine."

jalut avatar Mar 18 '16 06:03 jalut

Totally stupid idea imo. There is no need to change anything. You can only access the machine on the same network and the default password can be easily googled. No need for your "comittee".

mainrs avatar Jan 15 '17 10:01 mainrs

I'm pretty sure there isn't any immediate need to change the password here as these aren't the original scripts AFIK (Implying that it's probably not the same password. Even if I'm wrong, it's a default password for a coffeemaker in Russia that you would need to LAN access for anyways; it's not an issue worthy of the project curators time. If it bothers you that much, instead of spending 5 minutes to make an issue on github (And advertise your code auditing services on a repository which was intended as a joke), you could very easily have used that 5 minutes to change one line of code and make a pull request.

ghost avatar Jan 25 '17 00:01 ghost

Over 1 year open with no fix? I think you can publish a CVE safely and flood russian corporations with coffee.

mo9a7i avatar Jun 08 '17 08:06 mo9a7i

The troll is getting real here

mainrs avatar Jun 08 '17 11:06 mainrs

my wife imo hack by mobile number

Dharkancb avatar Oct 11 '18 03:10 Dharkancb

This could be CVE worthy for sure. Was this ticket ever resolved? I could use the extra PR for hacktoberfest 💪 😏

cyb3rpr0 avatar Oct 14 '19 17:10 cyb3rpr0

I'm sure that there are other projects that are way more important that you can contribute to as some small scripts that nobody uses anyways. A lot of great libraries within the Javascript ecosystem are out there that always love PRs :) @micknoy

mainrs avatar Oct 14 '19 18:10 mainrs