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

Doesn't work with TLS_RSA_WITH_AES_256_CBC_SHA256 cipher #6

Closed
porjo opened this issue Oct 13, 2019 · 16 comments
Closed

Doesn't work with TLS_RSA_WITH_AES_256_CBC_SHA256 cipher #6

porjo opened this issue Oct 13, 2019 · 16 comments

Comments

@porjo
Copy link

porjo commented Oct 13, 2019

Not a bug, just an FYI for others.

Go dropped support for cipher TLS_RSA_WITH_AES_256_CBC_SHA256 here.

My anyconnect provider has locked their endpoint to only accept this cipher, and so I get a TLS negotiation failure when attempting to connect 😢

@Gilks
Copy link
Owner

Gilks commented Oct 14, 2019 via email

@porjo
Copy link
Author

porjo commented Oct 14, 2019

The error I get when connecting to the Anyconnect endpoint is: tls: handshake failure

Nmap scan of the endpoint shows this:

$ nmap --script ssl-enum-ciphers <endpoint> -p 443
Starting Nmap 7.80 ( https://nmap.org ) at 2019-10-14 11:33 AEST
Nmap scan report for <endpoin>t (x.x.x.x)
Host is up (0.037s latency).

PORT    STATE SERVICE
443/tcp open  https
| ssl-enum-ciphers: 
|   TLSv1.2: 
|     ciphers: 
|       TLS_RSA_WITH_AES_256_CBC_SHA256 (rsa 2048) - A
|     compressors: 
|       NULL
|     cipher preference: indeterminate
|     cipher preference error: Too few ciphers supported
|     warnings: 
|       Forward Secrecy not supported by any cipher
|_  least strength: A

I tried this:

func handleConnection(conn net.Conn, isTLS bool, hostscan Hostscan) {
[...]
                conf := tls.Config{
                        InsecureSkipVerify: true,
                        CipherSuites:       []uint16{tls.TLS_RSA_WITH_AES_256_CBC_SHA256},
                }

but get compile error: ./hostscan-bypass.go:133:33: undefined: tls.TLS_RSA_WITH_AES_256_CBC_SHA256

@Gilks
Copy link
Owner

Gilks commented Oct 15, 2019

I don't see TLS_RSA_WITH_AES_256_CBC_SHA256 in the list of ciphers at all. I can't find evidence that golang ever had support for this specific cipher! How strange.

After some digging around it appears someone else added support for TLS_RSA_WITH_AES_256_CBC_SHA256 in a PR. It never looks like it was merged though. If you use the version of golang from this repository you may have some luck.

@porjo
Copy link
Author

porjo commented Oct 15, 2019

I can't find evidence that golang ever had support for this specific cipher!

You're right - I misread that earlier commit! Thanks, I'll check out that other repo. UPDATE: that repo fails to build 😞

@Gilks
Copy link
Owner

Gilks commented Oct 15, 2019

Hmm.. Well, I can't exactly test this idea but I don't see many changes in the commit that adds support for the TLS_RSA_WITH_AES_256_CBC_SHA256 cipher. Here's my attempt at trying to integrate it to the current version of golang using that commit.

I'd make a backup of the current ciphers_suites.go file and then copy this modified one into its place.. Fingers crossed that it works.

@porjo
Copy link
Author

porjo commented Oct 17, 2019

I tried building go with your file but it fails. What version of Go did you base that off? I followed the build instructions here https://golang.org/doc/install/source which uses 1.13.1

@Gilks
Copy link
Owner

Gilks commented Oct 17, 2019

I made an assumption I was on the latest version when in fact I was on version 1.12.9. I updated to version 1.31.1 and replaced cipher_suites.go with my modified version and received the following error when attempting to run the bypass:

/usr/local/go/src/crypto/tls/cipher_suites.go:18:2: cannot find package "internal/x/crypto/chacha20poly1305" in any of:
	/usr/local/go/src/vendor/internal/x/crypto/chacha20poly1305 (vendor tree)
	/usr/local/go/src/internal/x/crypto/chacha20poly1305 (from $GOROOT)
	/root/go/src/internal/x/crypto/chacha20poly1305 (from $GOPATH)

Here's the version of cipher_suites.go for golang 1.13.1. Sorry about that, I should have checked my version before claiming I was on the latest.

@porjo
Copy link
Author

porjo commented Oct 18, 2019

I tried again with the updated file. Compilation succeeds, however the test suite fails. Using the resulting go binary I've was able to compile hostscan-bypass and run it. This time it connects to the server, and I can see hexdumps of client traffic, however it doesn't complete and my client just sits at the 'enter your username and password' prompt. The client traffic is missing the endpoint string and hostscan-bypass never exits. Here's the (redacted) console output: https://pastebin.com/VjRt9U53

@Gilks
Copy link
Owner

Gilks commented Oct 18, 2019

That's odd. I'd assume if the SSL handshake went poorly that the connection would abort..

Are you using the hostscan-bypass from the git repo or are you working on a modified version?

EDIT: Also, are you seeing the AnyConnect client perform a posture assessment upon connection? The client is supposed to perform a GET /CACHE/sdesktop/install/binaries/update.txt right after it starts hanging for you.

Go to func handleServerMessage(...) and uncomment fmt.Printf("From Server [%d]:\n%s\n", id, hex.Dump(data[:n])) and try running it again. Maybe the server is responding with something that can give us a hint.

@porjo
Copy link
Author

porjo commented Oct 20, 2019

hostscan-bypass is from the git repo and unchanged except for the cipher modification and uncommenting printf lines.

I've emailed you the console output which includes server messages.

@Gilks
Copy link
Owner

Gilks commented Oct 21, 2019

Thank you for the log file! Looking over the log file you sent me I don't see any indication of hostscan being used in your environment. Are you sure your organization is using hostscan? You should see the following text should be visible when connecting with your AnyConnect client.

You could also try browsing to the following URL to see if there's any hostscan requirements being published.

https://<VPN Page>/CACHE/sdesktop/data.xml

@porjo
Copy link
Author

porjo commented Oct 21, 2019

You're right - it seems that no hostscan is required. Using hostscan-bypass to simply proxy traffic from my Linux openconnect client allowed me to connect succesfully! (I'd never tried this combination until now, thinking the issue was with hostscan and needing the CSD wrapper). The problem I have now is that hostscan-bypass consumes 100% cpu after connect and I doesn't pass traffic - I guess it wasn't intended to be a general purpose proxy 😄 I'll have a play with it and see what can be done. Thanks for your help!

@Gilks
Copy link
Owner

Gilks commented Oct 21, 2019

That's correct- the bypass was never intended to be a general purpose proxy. By the sounds of it you don't need the hostscan-bypass at all. You should just be able to use openconnect and connect directly to the network. Something like this:

openconnect <VPN URL>

Or if your environment doesn't allow the use of Linux/OS X you could try:

openconnect <VPN URL> --os=win

Hostscan is a feature that companies use to lockdown which assets are "allowed" to connect to the VPN. That's when you would need to use the hostscan-bypass. It generates a CSD file to mimic a corporate assets connection to the network. If hostscan is not in use you are usually free and clear to connect to VPN with openconnect.

@porjo
Copy link
Author

porjo commented Oct 21, 2019

You should just be able to use openconnect and connect directly to the network

That fails to negotiate TLS (due to the missing cipher support - it would appear that Go is not the only client that doesn't support that unusual cipher!). I'm just using hostscan-bypass for now as a convenient way to bridge the gap in cipher support. I'll find another proxy that is more suited to that task.

@Gilks
Copy link
Owner

Gilks commented Oct 21, 2019

If that's true I'd recommend opening up an issue on the OpenConnect repository over on gitlab. The devs are very responsive and quite helpful. I'd reference this issue while opening a request to add support for the TLS_RSA_WITH_AES_256_CBC_SHA256 cipher.

You could use the hostscan-bypass as a general purpose proxy but wouldn't it be so much nicer to be able to VPN directly from your linux host into the network?

EDIT: I am going to close this issue. If you decide to open an issue with the OpenConnect devs- feel free to post the link back here! I wouldn't mind seeing what they have to say on this.

@Gilks Gilks closed this as completed Oct 21, 2019
@porjo
Copy link
Author

porjo commented Oct 22, 2019

Good idea! I've created ticket here: https://gitlab.com/openconnect/openconnect/issues/83

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