News for hackers. Stuff that matters.
Re:Golang SSH Security by ge96 on Saturday April 15, 2017 @04:46PM (#14122765)
What are some clear signs that this is happening to you? I track the url requested on my server(s) and some of them don't make sense/looking for exploits like wordpress login exploits. I don't know I have SSL/A+ according to Qualys, I'm kind of drawing a blank where MITM happens. I've seen/read about it before. Heartbleed? No I don't know... really tired, but interested, gots to Google.

edit: I'm still on LAMP stack for clarification. Too bad to hear about Golang though I'm still looking to learn it I hear a lot of great things about it.

Re:Golang SSH Security by F30 on Saturday April 15, 2017 @04:52PM (#14122800)
MITM attacks are designed to not be detectable, so the solution is to have tooling which prohibits them – exactly what is lacking in this case.

For web, using TLS (SSL) is a good start. This could be improved further by using HSTS, HPKP, DANE etc. (not sure if A+ already implies them anyway).

For SSH, you need to have an out-of-band way to get the host keys or use something like an SSH CA.

Re:Golang SSH Security by ge96 on Saturday April 15, 2017 @05:10PM (#14122883)
What does that mean out-of-band? I'm not good with SSH, I'm not using 2-factor key based, also in general it makes sense to have separate servers right? Like one server that transfers request to a server closer to another country. Not Cloudflare but your own thing assuming you rented from different datacenters in the world. Sorry not related to the question.

edit: literally band? Like another wavelength/connection?

Re:Golang SSH Security by js2 on Saturday April 15, 2017 @05:26PM (#14122939)
Out-of-band means you need to transfer (or at verify) the ssh host key over something other than ssh for the initial connection. The host key is how the client verifies the server is who it says it is. The client caches the key after the initial connection. But for that initial connection, there's no way to know that the key isn't that of a MITM attacker.

One way to get the key out of band might be from the AWS console for example. Presumably that connection is protected via HTTPS where the CA infrastructure (theoretically) can protect against MITM attacks.

BTW, it's also possible to setup ssh to use certificates instead of simple keys which might make sense depending upon how many hosts you manage.

Re:Golang SSH Security by ge96 on Saturday April 15, 2017 @07:48PM (#14123494)
Thanks a lot for the information. You mentioned AWS console, that's not service-specific right? I haven't used AWS before. At any rate, lots too look up/research I appreciate your time.

At the moment I'm just dealing with a cheap domain-mapped single-core vps

Re:Golang SSH Security by azernik on Sunday April 16, 2017 @06:48AM (#14125275)
In that case, from an existing client with the SSH host key installed, or with your VPS provider's login shell system (if any), read the files '/etc/ssh/ssh_host_$ALGO_key.pub'. Each of these files will yield a line like this:

  ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBA4Ljuxwb9ss74agSmMRlBZdnIwMHprWIZ3Ts3G+hxnMmcQxeMAWoA4YXZwbrpQulFjDhjGqQoAGF+MKWXBpaeU= root@ip-172-31-17-215
These are all different hostkeys that the server might give to clients, depending on their mutually-agreed signature algorithm. This is in the same format as a line in the known-hosts file; all you need to do is replace that last bit (in my example, root@ip-172-31-17-215) with the hostname by which you log in (e.g. someserver.example.com). Once you've done that, append the results to the known_hosts file, either for your user account (~/.ssh/known_hosts) or system-wide (/etc/ssh/ssh_known_hosts).

tl;dr: replacing HOSTNAME with the hostname by which you access the server, run the following command on your server and append its output to ~/.ssh/known_hosts on new clients:

  cat /etc/ssh/ssh_host_*_key.pub | awk '$3="HOSTNAME"'
Re:Golang SSH Security by ge96 on Sunday April 16, 2017 @10:20AM (#14125880)
Thanks a lot. Right now I just use PuTTY, possibly SSH by command line (OS terminal). I'm not sure what I would put for the hostname that you mentioned (some domain) I imagine this will come after you do the out-of-bandwidth access thing which at the moment I just have one server but I think you can do it on the same server "on another bandwidth" yeah. I'm still not 100% but thank you for this.
Re:Golang SSH Security by _ikke_ on Sunday April 16, 2017 @08:39AM (#14125561)
Any kind of direct console access can be used (which many VPS providers offer).
Re:Golang SSH Security by MasterIdiot on Saturday April 15, 2017 @05:27PM (#14122945)
A different network connection (With physical infrastructure you might actually use a completely different network) that you can use to move private keys or any other sensetive information without exposing it to the Internet. We use such a network to monitor all of our infrastructure, and for iLo.
Re:Golang SSH Security by ge96 on Saturday April 15, 2017 @07:54PM (#14123524)
Thanks for your input. I have to look into this more. Have to plan stuff out for the future when growing past the single vps "instance"
Re:Golang SSH Security by vbezhenar on Saturday April 15, 2017 @04:58PM (#14122828)
There are bots who mindlessly throwing HTTP requests on some known vulnerabilities, they don't really check whether you're running wordpress or not. Every web server bombarded by those requests, that's not something you should be worried about.
Re:Golang SSH Security by ge96 on Saturday April 15, 2017 @05:09PM (#14122876)
Yeah I don't use Wordpress but I just happened to see them looking at logs.

I am worried because I don't know. I covered some basics like SSL, XSS (htmlescape), sessions are redirect related, PDO/sql... no ddos/load balance... backup backup

Re:Golang SSH Security by openasocket on Saturday April 15, 2017 @05:34PM (#14122967)
That is what we like to call the background noise of the internet. Scanners are always scanning. Try this as an experiment sometime: make a brand new instance on your favorite cloud provider, and just run tcpdump on it for a few hours. You'll see all kinds of cool things: from people scanning for HTTP, Telnet, people scanning for SSH servers with weak passwords, router exploits with shellcode embedded in a UDP packet, back-scatter from DDoS attacks, cool stuff. Honestly looking at each packet and trying to figure out what's going on is a pretty great way to learn.
Re:Golang SSH Security by ge96 on Saturday April 15, 2017 @07:56PM (#14123540)
I did trace one of them and it lead to some "what appears to be" fake cloud provider. It had a cliche login form/company name but it didn't seem legit.

I'm not sure if it's possible to "bounce off" an attack from someone else's ip, by "attack" I mean a specific requested URL that is looking for an exploit.

Re:Golang SSH Security by narrowrail on Saturday April 15, 2017 @08:00PM (#14123558)
URLs don't request things on the internet, IPs do.

This may also be a good read:

https://en.wikipedia.org/wiki/Reflection_attack

Re:Golang SSH Security by ge96 on Sunday April 16, 2017 @10:20AM (#14125886)
Thanks for the clarification and the good read.
Re:Golang SSH Security by CapacitorSet on Saturday April 15, 2017 @06:12PM (#14123133)
If you want to study the background noise, I think you would have better luck reacting to it - as well as running tcpdump, set up a trivial HTTP and SSH server and observe the interactions.
Re:Golang SSH Security by ge96 on Saturday April 15, 2017 @08:05PM (#14123582)
I'll have to lookup TCP dump, I wrote a basic ip-incoming-request tracker and also sometimes see the error log.

it is crazy to just randomly try different octet combinations to form a new ip and see what you get... what about ipv6 hoho

thanks

Re:Golang SSH Security by drostie on Saturday April 15, 2017 @06:33PM (#14123216)
I think you're being downvoted because there are two readings of your first question and reading the whole paragraph is needed to understand that the flippant reading "Psh, you say this is happening to you but I don't believe you, show me some evidence" is wrong and the humble reading "hey, how can I know that this is happening to me -- is it in the log files?" is correct. (It could also be that you're confessing ignorance even though you're also claiming certification though.)

The easiest MITM attacks for a civilian to perform involve a wireless router that traffic is routed over, with mildly more complicated but similar setups near a server -- say an untrusted server farm for example, or a malicious employee at a self-hosted location. More complicated attacks require messing with DNS so that people wanting to connect to that host instead connect to you; and really big entities like governments or advertising-hungry service providers could of course try to set something bigger up that affects more people.

The basic necessity is that the MITM computer needs to have an IP address, because the premise of MITM is, "you issue a request to connect securely to server IP 123.45.67.89, but you send your packets through me, and I have access to some IP 98.76.54.32. So now I intercept them rather than forwarding them on, and I connect securely to 123.45.67.89 myself, as well as to you. Now everything you try to send to them gets through, and its response gets back to you, but not before I intercept it and decrypt it and store it for later retrieval.

So the simplest way to do something like SSH is to imagine that I ask for your public key, you give it to me, I encrypt a shared private key with your public key, I send it to you, you decrypt it, and we use this private key for the rest of our communication. (That's not what SSH does, SSH does Diffie-Hellman, but similar reasoning applies.)

A MITM attack is then, you ask for the public key, I make a public/private key pair, I send you that public key, I ask for the remote server's private key for myself. You send me a private key, I send the remote server a different private key, and when you send something to the server, I now decrypt what you sent me, then encrypt it and send to the server.

Your main means of security in this scenario is actually 100% the same as your main means of security in SSH, it is that you trust that the private key of the server does not change very often. Therefore when you connect, you store the first public key you ever see; then each time you connect, you double-check it's the same or else you shout at the user "HEY! someone could be overhearing your data! Are you SURE you want to connect still?"

What's at issue in the article is that this crucial step was totally ignored by Hashicorp, it was brought to their attention and they just missed it.

Re:Golang SSH Security by ge96 on Saturday April 15, 2017 @08:03PM (#14123574)
The SSL thing yeah I tested my Apache configuration on Qualys it's an A+ I got help from people. It was a few weeks/month? ago... recently there was some new bug or something found and I was briefly dropped to like a C and then fixing one cypher suite or something made it go back up to an A+. I might have to deal with this again when I switch to Lets Encrypt.

I saw the wireless thing when briefly looking up MITM attacks.

>you issue a request to connect securely to server IP 123.45.67.89, but you send your packets through me, and I have access to some IP 98.76.54.32

Sounds like a VPN no? Haha (not a serious remark)

You say decrypt, I thought you can't decrypt or hard to if you're using SSL?

Yeah this is beyond me right now the whole time I'm thinking Port 80, regular web not SSH (22? or whatever port assigned), it's hard to think that's intercepted as well but why not, its just a port? Yeah thanks for taking the time to write this, I'll refer to it when learning more about this "have my bases covered"

I'm always skeptical connecting to public networks (try not to) or use a burner device or something without typing in passwords/https.

Re:Golang SSH Security by drostie on Saturday April 15, 2017 @10:11PM (#14123983)
You're not wrong to notice the VPN side: what are most of our examples? Malicious service providers! What's a VPN? An intermediate service provider!

I did say decrypt, and I did really mean it. SSH and TLS are not nebulously "hard to decrypt", otherwise we wouldn't use it because our servers couldn't decrypt the communications from our clients. They are hard to decrypt if you don't know a shared key. In MITM there are two shared keys: the client shares one key with the interceptor, the interceptor shares another key with the server. That's why the interceptor can decrypt.

Furthermore if we're talking the normal open Internet, the interceptor-server negotiation is dead simple because it looks to the server like any client-server negotiation. If you let anyone on the Internet access your pages through TLS, there is no hope to catch MITM on the server-side. It has to be defended client-side.

There is fundamentally no way to stop an interceptor who you have to send messages through from throwing away those messages and sending you the reply, "why yes, I really am https://mail.google.com/, here's my public key, let's negotiate a shared key so that we can talk in secret." Nothing. Because, you don't have an encrypted connection before you've negotiated that shared key. You aren't encrypted before you're encrypted. So for that setup phase, there's no way to stop them from throwing out those packets and sending that reply; we can only hope to detect that they are lying.

Now they are only telling us one thing, "here is my public key", and we want to know if they are lying about that. We have come up with exactly two strategies to deal with this client-interceptor side.

1. Like SSH does, admit defeat: but only for the very first connection. The very first connection, yeah, that could be intercepted. Then I will store your public key forever. Every time afterwards I will either use that public key, or else I will fire up the klaxons warning my user, and they will have to manually approve connecting and storing the new key. And that means you'll have to keep intercepting my traffic--even if I take my laptop to a different location or whatever--or else I'll find you out eventually.

2. Like TLS does, communicate some way of authenticating that public key through some other mechanism than the current internet connection. This usually happens quietly as part of downloading a web browser: that browser comes with a list of public keys of authorities whose digital signatures are trusted by the browser for authenticating public keys. If a site just sends me their public key? Forget it! They have to send me their public key plus a certificate issued from one of these authorities, saying "Yes, that is a valid public key for that domain," signed by a private key whose public key I know and trust. As long as I can verify digital signatures and they cannot be copied, I am good.

These are called "Trust on First Use" and, well, I'm not sure what you'd call what TLS does. Something like an "out-of-band" configuration of a "web of trust" I suppose. So those are the only options we've gotten working at scale, TOFU and OOBWOT.

Re:Golang SSH Security by ge96 on Monday April 17, 2017 @01:09AM (#14129320)
Thanks I will have to go down this road at some point. Have to learn a bunch still. Sorry I didn't see this sooner, had a wall of text to look through (not yours other replies from other posts).