Search code examples
javaencryptionjenkinsjenkins-plugins

How to decrypt Jenkins 8mha values


If we look at the Jenkins job logs, we can see that the text contained there, is exactly the same as what is displayed in the browser when you look into the Console Output EXCEPT for the URL that in the log files is encoded with something with the tag [8mha:

Does anyone know how can we "decrypt" it?

Already tried a simple base64 but it doesn't work.

This is one of those strings

[8mha:AAAAqR+LCAAAAAAAAP9b85aBtbiIQSajNKU4P08vOT+vOD8nVc+jsiC1KCczL9svvyTVzHb1RttJBUeZGJg8GdhyUvPSSzJ8GJhLi3JKGIR8shLLEvVzEvPS9YNLijLz0q0rihik0IxzhtAgwxgggJGJgaGiAMiQL2HQ0c/KT9J3zkhNzs4vLVE1MtAFYpfEkkQg5ZuYl5ieWgRkBbgF65sa6QMAtVXQDbEAAAA=[0m

Solution

  • https://github.com/LarrysGIT/Extract-Jenkins-Raw-Log/blob/master/README.md

    Short answer here,

    It's not encrypted, it still BASE64 string,

    Example,

    Started by user [8mha:////4H+H6gi+RzqRXgbuxDkiDNvJYq3pMCu17+YXxGOB+mHbAAAAlx+LCAAAAAAAAP9b85aBtbiIQTGjNKU4P08vOT+vOD8nVc83PyU1x6OyILUoJzMv2y+/JJUBAhiZGBgqihhk0NSjKDWzXb3RdlLBUSYGJk8GtpzUvPSSDB8G5tKinBIGIZ+sxLJE/ZzEvHT94JKizLx0a6BxUmjGOUNodHsLgAzWEgZu/dLi1CL9xJTczDwAj6GcLcAAAAA=[0madmin

    Can be split to the following parts,

    A string: Started by user

    Preamble: \u001B[8mha:

    Base64 string: ////4H+H6gi+RzqRXgbuxDkiDNvJYq3pMCu17+YXxGOB+mHbAAAAlx+LCAAAAAAAAP9b85aBtbiIQTGjNKU4P08vOT+vOD8nVc83PyU1x6OyILUoJzMv2y+/JJUBAhiZGBgqihhk0NSjKDWzXb3RdlLBUSYGJk8GtpzUvPSSDB8G5tKinBIGIZ+sxLJE/ZzEvHT94JKizLx0a6BxUmjGOUNodHsLgAzWEgZu/dLi1CL9xJTczDwAj6GcLcAAAAA=

    Postamble: \u001B[0m

    A string: admin

    Convert the base64 string to bytes, trim the first 40 bytes (https://github.com/LarrysGIT/Extract-Jenkins-Raw-Log/issues/1) and save as .gz file. Now you can extract real content from the .gz file.

    In this case, the content is type Java serialization data, version 5 following

    ¬í sr !hudson.console.ModelHyperlinkNote xr hudson.console.HyperlinkNote6=«±=’pÅ I lengthL urlt Ljava/lang/String;xr hudson.console.ConsoleNote xp t /user/admin