Skip to content

Error: 140735127326720:error:1408F119:SSL routines:SSL3_GET_RECORD:decryption failed or bad record mac #4161

Description

@santigimeno

With latest master, I was trying to track down some flakiness in test-tls-inception.js, so I increased the data sent from the socket at the b server like this:

diff --git a/test/parallel/test-tls-inception.js b/test/parallel/test-tls-inception.js
index df03cf9..4dc885d 100644
--- a/test/parallel/test-tls-inception.js
+++ b/test/parallel/test-tls-inception.js
@@ -38,7 +38,7 @@ a = tls.createServer(options, function(socket) {

 // the "target" server
 b = tls.createServer(options, function(socket) {
-  socket.end('hello');
+  socket.end((new Buffer(4000)).fill('a'));
 });

 process.on('exit', function() {

and got this error:

events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: 140735127326720:error:1408F119:SSL routines:SSL3_GET_RECORD:decryption failed or bad record mac:../deps/openssl/openssl/ssl/s3_pkt.c:532:

    at Error (native)

Reducing the size of the Buffer to 3000 does not cause the error. Is this expected or a bug?

Thanks

Activity

  1. added
    tlsIssues and PRs related to the tls subsystem.
    on Dec 4, 2015
  2. jhamhader commented on Dec 5, 2015

    @jhamhader
    Contributor

    I began investigating this one.
    It happens with a buffer or string size >= 3810 and write() also triggers it.

  3. mscdex commented on Dec 8, 2015

    @mscdex
    Contributor

    Ok, so it looks like the cleartext data is probably getting mixed with the underlying TLS exchange somehow (hence the protocol error). To verify this, if you wait until you see the secureConnect event of the second tls.connect() to do socket.end(message); in TLS server b, it will work just fine (you can accomplish this using an event emitter or calling a function that gets set inside b's connection handler that wraps socket.end(message);). Alternatively, wrap the socket.end(message); in a setTimeout() of like 1 second or so for the same effect.

  4. mscdex commented on Dec 8, 2015

    @mscdex
    Contributor
  5. indutny commented on Dec 8, 2015

    @indutny
    Member

    Will look into this tomorrow.

  6. indutny commented on Dec 8, 2015

    @indutny
    Member

    Actually, I have a fix for it right now.

  7. indutny commented on Dec 8, 2015

    @indutny
    Member

    Here you go #4184 . Thanks for figuring it out!

  8. added
    confirmed-bugIssues and PRs for confirmed bugs.
    c++Issues and PRs that require attention from people who are familiar with C++.
    on Dec 8, 2015
  9. indutny commented on Dec 8, 2015

    @indutny
    Member

    Fixed!

  10. vongohren commented on Aug 23, 2017

    @vongohren

    I recieved this today on my heroku server: Aug 23 06:00:00 0c5e4c77-c2c9-445d-aff8-3564937f7520 comicFeed: error We’ve encountered an error: Error: 140094844344192:error:1408F119:SSL routines:SSL3_GET_RECORD:decryption failed or bad record mac:../deps/openssl/openssl/ssl/s3_pkt.c:535:

    The server is running node 7.10
    But I dont have much else to go on.

  11. Trott commented on Aug 23, 2017

    @Trott
    Member

    The server is running node 7.10

    @vongohren 7.x is unsupported. If you can, consider upgrading to 8.x (which will be supported until the end of 2019). No idea if this will fix your issue, but it's the first thing I'd try.

  12. petermetz commented on Apr 9, 2019

    @petermetz

    Just received this on macOS Mojave running Node 8, please see details below:

    Error: 4571538880:error:1408F119:SSL routines:SSL3_GET_RECORD:decryption failed or bad record mac:../deps/openssl/openssl/ssl/s3_pkt.c:535:
    openssl version
    OpenSSL 1.0.2l  25 May 2017
    node --version
    v8.15.1
  13. sam-github commented on Apr 16, 2019

    @sam-github
    Contributor

    @petermetz You are using openssl 1.0.2l, but node 8.15.1 uses openssl 1.0.2r. You should ensure that this isn't specific to your non-standard build. Also, the bug fixed here has been backported to 8.15.1, as far as I can see from a quick check, so you should report this as a different bug. It would help to have a reproduction.

  14. satendrasingh51 commented on Dec 11, 2021

    @satendrasingh51

    @sam-github @mscdex @silverwind @indutny @Trott
    same error on all dependence installation

    npm ERR! code ERR_SSL_DECRYPTION_FAILED_OR_BAD_RECORD_MAC
    npm ERR! 8896:error:1408F119:SSL routines:ssl3_get_record:decryption failed or bad record mac:c:\ws\deps\openssl\openssl\ssl\record\ssl3_record.c:677:
    npm ERR!
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     C:\Users\Satendra singh\AppData\Local\npm-cache\_logs\2021-12-11T05_34_29_970Z-debug.log
    
  15. Trott commented on Dec 11, 2021

    @Trott
    Member

    @sam-github @mscdex @silverwind @indutny @Trott same error on all dependence installation

    npm ERR! code ERR_SSL_DECRYPTION_FAILED_OR_BAD_RECORD_MAC
    npm ERR! 8896:error:1408F119:SSL routines:ssl3_get_record:decryption failed or bad record mac:c:\ws\deps\openssl\openssl\ssl\record\ssl3_record.c:677:
    npm ERR!
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     C:\Users\Satendra singh\AppData\Local\npm-cache\_logs\2021-12-11T05_34_29_970Z-debug.log
    

    What version of Node.js are you running?

  16. satendrasingh51 commented on Dec 12, 2021

    @satendrasingh51

    @sam-github @mscdex @silverwind @indutny @Trott same error on all dependence installation

    npm ERR! code ERR_SSL_DECRYPTION_FAILED_OR_BAD_RECORD_MAC
    npm ERR! 8896:error:1408F119:SSL routines:ssl3_get_record:decryption failed or bad record mac:c:\ws\deps\openssl\openssl\ssl\record\ssl3_record.c:677:
    npm ERR!
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     C:\Users\Satendra singh\AppData\Local\npm-cache\_logs\2021-12-11T05_34_29_970Z-debug.log
    

    What version of Node.js are you running?

    Node version is 14,
    I have updated node version right now 16,

    And in node js version 16

    Error is

    npm ERR! code ERR_SSL_CIPHER_OPERATION_FAILED
    npm ERR! errno ERR_SSL_CIPHER_OPERATION_FAILED
    npm ERR! Invalid response body while trying to fetch https://registry.npmjs.org/react-scripts: 3C160000:error:1C800066:Provider routines:ossl_gcm_stream_update:cipher operation failed:c:\ws\deps\openssl\openssl\providers\implementations\ciphers\ciphercommon_gcm.c:312:
    npm ERR!
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     C:\Users\ss719\AppData\Local\npm-cache\_logs\2021-12-12T10_20_04_982Z-debug.log
    
  17. Trott commented on Dec 12, 2021

    @Trott
    Member

    Sounds like a network/firewall/proxy problem. If you're on WiFi, maybe try moving to another network.

  18. satendrasingh51 commented on Dec 12, 2021

    @satendrasingh51

    But on network change this error
    npm ERR! Cannot read properties of undefined (reading 'isServer')

  19. Trott commented on Dec 12, 2021

    @Trott
    Member

    But on network change this error npm ERR! Cannot read properties of undefined (reading 'isServer')

    Maybe try npm cache clear --force. If that doesn't work, you can try the npm issue tracker , the Node.js help repo, StackOverflow, #node.js channel on libera.chat, or Node.js Slack Community (register at nodeslackers.com). This seems unlikely to be a Node.js core bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    c++Issues and PRs that require attention from people who are familiar with C++.confirmed-bugIssues and PRs for confirmed bugs.tlsIssues and PRs related to the tls subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions