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

Custom SCEP Client works for NDES, not GO SCEP Server #224

Open
herbfalkmi opened this issue Dec 4, 2023 · 18 comments
Open

Custom SCEP Client works for NDES, not GO SCEP Server #224

herbfalkmi opened this issue Dec 4, 2023 · 18 comments

Comments

@herbfalkmi
Copy link

The GO SCEP Server complains that it can't decrypt the PKC7 payload.

Here is a decode of the CMS information (minus being decrypted).

ContentInfo SEQUENCE (2 elem)
contentType ContentType OBJECT IDENTIFIER 1.2.840.113549.1.7.3 envelopedData (PKCS #7)
content [0] (1 elem)
EnvelopedData SEQUENCE (3 elem)
version CMSVersion INTEGER 0
recipientInfos RecipientInfos SET (1 elem)
RecipientInfo SEQUENCE (4 elem)
version CMSVersion INTEGER 0
rid RecipientIdentifier SEQUENCE (2 elem)
issuer Name SEQUENCE (4 elem)
RelativeDistinguishedName SET (1 elem)
AttributeTypeAndValue SEQUENCE (2 elem)
type AttributeType OBJECT IDENTIFIER 2.5.4.6 countryName (X.520 DN component)
value AttributeValue [?] PrintableString US
RelativeDistinguishedName SET (1 elem)
AttributeTypeAndValue SEQUENCE (2 elem)
type AttributeType OBJECT IDENTIFIER 2.5.4.10 organizationName (X.520 DN component)
value AttributeValue [?] PrintableString scep-ca
RelativeDistinguishedName SET (1 elem)
AttributeTypeAndValue SEQUENCE (2 elem)
type AttributeType OBJECT IDENTIFIER 2.5.4.11 organizationalUnitName (X.520 DN component)
value AttributeValue [?] PrintableString SCEP CA
RelativeDistinguishedName SET (1 elem)
AttributeTypeAndValue SEQUENCE (2 elem)
type AttributeType OBJECT IDENTIFIER 2.5.4.3 commonName (X.520 DN component)
value AttributeValue [?] PrintableString MICROMDM SCEP CA
serialNumber CertificateSerialNumber INTEGER 1
keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier SEQUENCE (2 elem)
algorithm OBJECT IDENTIFIER 1.2.840.113549.1.1.1 rsaEncryption (PKCS #1)
parameters ANY NULL
encryptedKey EncryptedKey OCTET STRING (256 byte) 3DFA635EF5C92385CBBAEA03366AB54613C7523A814A7C7071DC62FAB1F01B72458A6…
encryptedContentInfo EncryptedContentInfo SEQUENCE (3 elem)
contentType ContentType OBJECT IDENTIFIER 1.2.840.113549.1.7.6 encryptedData (PKCS #7)
contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier SEQUENCE (2 elem)
algorithm OBJECT IDENTIFIER 2.16.840.1.101.3.4.1.42 aes256-CBC (NIST Algorithm)
parameters ANY OCTET STRING (16 byte) 11554D0A8B54B7E9357979080E0701B8
EncryptedContent [?] [0] (752 byte) 091B26A6F56E0546D302610A13EE597C739733F9B4D05DCC1B0E18390D250E09F4540…

Any Ideas?

@jessepeterson
Copy link
Member

jessepeterson commented Dec 4, 2023

Which version are you using? Can you try 0.2.1 if you're using the newest 0.2.2? Thanks!

@herbfalkmi
Copy link
Author

herbfalkmi commented Dec 4, 2023 via email

@hslatman
Copy link
Contributor

hslatman commented Dec 4, 2023

Here's the P7 in a nicer format: https://lapo.it/asn1js/#MIIKOAYJKoZIhvcNAQcCoIIKKTCCCiUCAQExDDAKBggqhkiG9w0CBTCCBMAGCSqGSIb3DQEHAaCCBLEEggStMIIEqQYJKoZIhvcNAQcDoIIEmjCCBJYCAQAxggFtMIIBaQIBADBRMEwxCzAJBgNVBAYTAlVTMRAwDgYDVQQKEwdzY2VwLWNhMRAwDgYDVQQLEwdTQ0VQIENBMRkwFwYDVQQDExBNSUNST01ETSBTQ0VQIENBAgEBMA0GCSqGSIb3DQEBAQUABIIBAI8wHEvdKnY_wMQvsPak_qi3hYzV1ytCr94vCztVbt-nqnrXXs-z0pcZ8oYkDdgWXtetbY7cmHjcnpAITvEpBkZAoAU4jDC7PAZzXDHAyBknEaFtNkn_meRl_XLHVfZWmjdZih16yqtJr43R3eBqfHvGuUb5ondaWoSU_JbnPi1T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DzNbwauYSrEhdj51tKHYFkrlNuUbpIjnovadlCT6c3EsYNdtZuGtU_2SpOEnx93E9huWeP4l32xYMoBKXd8-i3I4wyJcaCL3PTLgRT-zw13R6_mAjCKv1Q_W3igJrIl4tBBex2r7mybRd0ZAXc7NSEiISCY8AZFPcBfzjxZ-x1BtyS-QsCntUaoIKf5nssA4BD5YVHZMYICDTCCAgkCAQEwNTApMScwJQYDVQQDEx5HYXJpYmFsZGkgV0lOLTlIRTg5NlZTVFU1IGdkb2kCCBr3UPqcAwJ2MAoGCCqGSIb3DQIFoIGvMBIGCmCGSAGG-EUBCQIxBBMCMTkwGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAfBgkqhkiG9w0BCQQxEgQQpbBktx53Eym2_-cagcyWuTAgBgpghkgBhvhFAQkFMRIEEOVCXExqooHIJ1jLmrdJhvMwPAYKYIZIAYb4RQEJBzEuEyx0alFoNzMzc3B4NC9UNW9ua2QyY1phNDQxTTNzUWh6aURGNkR5VW5wY2JZPTALBgkqhkiG9w0BAQEEggEAwwcwrZq3D9-hW9TUS2VGOQGQUUum60yo_NpkVjU7V_fa-glaj8DD8n-mFQSDNyp1UQnhdlj1iBK-adefi_1Iqu3abv7-7tkYIyUbdBCH5iA-Ri34RbmqtugcZCPlD1GCXLuUj33SrYgQ1DDBpD5EnuUHa-ylIuoSXI9u6jMp9vjRQe_zx573zMmyc5duAZ1Vdsu6OAP5uUuj5f6fi1C40iY9qUXuoG9zkpbTMA8JLjuQWFUFrQwhNuwmROCVmUk7OiIhZLDQxb2IwP929W9Z4GMiJ9AXtYeSkbiPzKfnR73iJiWTXADZieuqLHvKauvyX1IpmFb2p2NjVODDBWIrUA

Quick reproducer:

# error:
2023/12/04 21:51:55 pkcs7: cannot decrypt data: only RSA, DES, DES-EDE3, AES-256-CBC and AES-128-GCM supported

Some debug statement in getHashForOID, as it's one of the locations where ErrUnsupportedAlgorithm is returned:

1.2.840.113549.2.5

1.2.840.113549.2.5 is the OID for MD5 hashing. That's not supported in the Go package used for PKCS7 operations, and likely won't be supported either, unless we can/want to/will do some very legacy mode.

@herbfalkmi do you have control over the hashing algorithm used by the client? I would suggest upgrading to SHA256.

I'll make a note an issue to fix his error message in pkcs7. It's not the right error message to return in this case. It seems like MD5 was also not supported before we forked the package, so that's not the issue.

@herbfalkmi
Copy link
Author

herbfalkmi commented Dec 4, 2023 via email

@hslatman
Copy link
Contributor

hslatman commented Dec 4, 2023

@herbfalkmi that one's harder to debug without the private key, as it operates on the decrypted data.

What SCEP client are you using? I see you're running on Windows, but it doesn't look like the built-in (MDM) SCEP client. It might be possible to replicate.

If you run the server with a small patch here as follows, you should get some additional output with the decrypted CSR in it, which can then be inspected more easily.

fmt.Println(base64.StdEncoding.EncodeToString(msg.pkiEnvelope))

Alternatively, you can provide the cert + key.

@herbfalkmi
Copy link
Author

herbfalkmi commented Dec 5, 2023 via email

@herbfalkmi
Copy link
Author

herbfalkmi commented Dec 5, 2023 via email

@herbfalkmi
Copy link
Author

herbfalkmi commented Dec 5, 2023 via email

@hslatman
Copy link
Contributor

hslatman commented Dec 5, 2023

Putting that base64 data into x509.ParseCertificateRequest results in the below certificate request data:

Certificate Request:
    Data:
        Version: 0 (0x0)
        Subject: CN=CN=Garibaldi WIN-9HE896VSTU5 gdoi
        Subject Public Key Info:
            Public Key Algorithm: RSA
                Public-Key: (2048 bit)
                Modulus:
                    d2:fa:4e:78:f8:0e:51:96:cd:c4:a4:a4:7a:61:e3:
                    28:52:35:03:16:1f:7c:10:fe:7b:8e:07:7a:52:40:
                    d8:0b:8e:36:c4:82:80:9b:fc:49:8b:b4:a7:fe:17:
                    88:31:30:2b:71:11:12:bb:d2:bc:d9:4c:7b:1b:30:
                    c5:b9:3d:ac:37:aa:08:43:17:df:2e:40:55:59:57:
                    fc:3b:0a:17:6a:d8:1a:ba:b0:e7:e9:43:47:7e:6e:
                    ea:24:8e:cf:b7:14:b2:34:59:23:e5:e9:55:72:3d:
                    18:9f:e3:79:45:c9:5b:27:73:50:c0:be:19:17:2f:
                    ad:ba:71:bb:c6:6c:21:ef:01:83:49:e1:ed:0e:bd:
                    d1:85:7f:81:56:47:f7:aa:26:bc:0d:d6:fa:22:81:
                    6f:ed:3c:6a:c1:37:44:be:e5:aa:50:04:f5:73:7c:
                    8d:e5:b9:9a:4d:66:a2:e8:2d:82:3d:34:07:42:b3:
                    46:26:65:9e:1f:0c:8a:b7:6f:7f:62:f6:bc:db:da:
                    04:a1:91:bd:02:5b:29:a5:cf:f6:7b:39:d8:fb:8d:
                    00:6d:89:87:31:e9:5c:3b:4e:85:22:6f:4e:6b:d9:
                    de:3b:00:f7:f5:7f:08:e8:9e:9f:28:e0:83:6f:96:
                    09:86:77:7c:cd:25:ec:c4:09:36:fb:71:ef:57:40:
                    99
                Exponent: 65537 (0x10001)
        Requested Extensions:
        Attributes:
            2.16.840.1.113733.9.7:
                ..J6....
                7f:b5:4a:36:c1:12:09:c0
            2.16.840.1.113733.9.2:
                19
            2.16.840.1.113733.9.5:
                Dƭ.....+._0...z
                44:c6:ad:a1:9f:b2:18:94:2b:04:5f:30:2e:ab:9c:7a
    Signature Algorithm: SHA256-RSA
         c3:8a:bd:16:d0:a9:b7:df:59:72:a2:3e:d5:d1:aa:70:68:16:
         39:47:19:df:3a:2b:af:47:e0:31:bd:a1:d4:94:fc:52:19:ef:
         b0:77:ec:de:af:21:b2:83:2d:a5:e2:0f:ca:1a:65:e0:27:6f:
         cc:fe:cb:32:01:5b:15:71:4a:80:95:a8:4c:54:00:9d:f7:e3:
         bf:5b:39:46:32:99:21:b2:41:9a:bc:16:68:ed:d1:a9:30:86:
         54:15:4b:d7:0b:b7:e3:9c:d2:f3:a7:ea:06:d8:55:83:c9:52:
         85:f1:1c:52:6a:72:d3:9e:62:4a:e3:8c:a5:9a:f9:00:d6:3e:
         98:01:5a:83:06:b7:ec:ad:fe:b2:d3:0f:4a:41:80:f5:80:7b:
         47:5e:64:bb:85:81:cc:80:d2:36:e0:de:99:16:0e:a0:3b:14:
         71:84:c4:1d:27:64:59:27:83:56:75:05:f0:26:1b:c5:fb:1f:
         7d:f7:cf:d6:d4:a4:6d:af:8f:a6:2e:d9:33:98:98:86:90:c7:
         8d:51:99:dd:2b:f6:7f:01:ef:43:2c:b1:c0:a5:32:51:89:ce:
         cf:83:9b:04:e9:00:0d:3a:31:ed:f5:27:7a:86:36:57:a2:73:
         b5:b6:4a:77:d2:04:4d:c0:f0:3b:e9:de:33:5d:d0:2b:59:a1:
         e1:9c:d1:0f

So that seems to work as expected; no ASN1 error in this case.

Is it returning an error for you every time? Or only in some cases?

@herbfalkmi
Copy link
Author

herbfalkmi commented Dec 5, 2023 via email

@hslatman
Copy link
Contributor

hslatman commented Dec 5, 2023

@herbfalkmi so the CSR you provided previously wasn't the decrypted value?

Compilation of the server is described here: https://github.com/micromdm/scep#compiling-from-source.

At the moment I'm not inclined to do a remote debug session.

@herbfalkmi
Copy link
Author

herbfalkmi commented Dec 10, 2023 via email

@hslatman
Copy link
Contributor

If you run go build -ldflags "-X main.version=v2.2.0-1-gaa863fe" -o scepclient-windows-amd64.exe ./cmd/scepclient in your terminal, it'll pick the right values for your Windows installation automatically. Then you don't need to use make.

@herbfalkmi
Copy link
Author

herbfalkmi commented Dec 10, 2023 via email

@herbfalkmi
Copy link
Author

herbfalkmi commented Dec 11, 2023 via email

@hslatman
Copy link
Contributor

Running it with an active debugger may not be required. Try adding the fmt.Println (on line 351 in scep/scep/scep.go) as described below, compile it again, and then run it:

If you run the server with a small patch here as follows, you should get some additional output with the decrypted CSR in it, which can then be inspected more easily.

fmt.Println(base64.StdEncoding.EncodeToString(msg.pkiEnvelope))

That should print the decrypted message.

@herbfalkmi
Copy link
Author

herbfalkmi commented Dec 11, 2023 via email

@hslatman
Copy link
Contributor

hslatman commented Dec 11, 2023

I tried running it locally with the MicroMDM SCEP server. Using the below base64-URL encoded data in a GET request with Postman to http://127.0.0.1:5004/scep?operation=PKIOperation&message= results in pkcs7: no enveloped recipient for provided certificate on my side, which makes sense, because I don't have the right recipient configured.

MIIJrQYJKoZIhvcNAQcCoIIJnjCCCZoCAQExDTALBglghkgBZQMEAgEwggQjBgkqhkiG9w0BBwGgggQUBIIEEDCCBAwGCSqGSIb3DQEHA6CCA%2F0wggP5AgEAMYIBUDCCAUwCAQAwNDAvMQswCQYDVQQGEwJDQTENMAsGA1UEChMER0UtMjERMA8GA1UECxMITXVsdGlsaW4CAQEwDQYJKoZIhvcNAQEBBQAEggEAif%2Fon81e7p3Mj7aXd8cmPGZcLCK%2B0a3Ko65VpOIqvEq7292ZAs92XQ2klfUKGbxY9nagATG7JMKM97%2FPFU1SiYTKz20VahfmkUChN3CjCh%2Bk3gB6juck0YPSt4Apo2pMz6OLabNexzoG3e63RZn6zlM5zAnLioahqIblSV6rG10oYPt5IQQct2JPTk2ANDBK6kKvDLXW%2BdXULao8vy%2FbQIdRlMPxbLONd2VE88TQ5A%2FmkXE9sYVdqh7LHZRn%2Fy0AIt8Ao4wba5YeO%2BJS1TCAFN500GLvnN%2FMpTzGs7LzKk6fgtYzB1P8Qi2NMRx2a7Uwc2xwFxy3n0%2BsmdXBxOISaDCCAp4GCSqGSIb3DQEHBjAdBglghkgBZQMEASoEEFLUqW3TkH0N5ll%2FdeZ%2FMuaAggJw0uae6%2FPoP7OgIRgmnxPz31wNx4fHtEpsoWTLYDWBRQSV7uzJrrgvgCV3v8qQmpFJnwAfFuwNvwN6vS1BV7PWq355QVcoUliaG0%2FFtzWNC%2BIRbPg1mf9NceiY1%2FIYFbZ4oxjaejCyktMxGo1wGuNnZIbCs8jJTtaL4qwUqsjYfkq2oVAW5DvUyNNgNrneH8r5pvzMW155tm%2BnGoOuT5iP5bQLTXrH9WodvF%2FuDCEnDspMSqfhxDs5DdQvy%2BJYxe30f6UP3fmymW1CRUYLUqN76hreAen5rJKmtulx6XbYSTG3Tk7YXhMhhgwjvEYlMwS%2FQXliqxxKwER01pRS91TuGGCn4BzITmz%2FHCEAXsvAya6t87iffZ09pwqUT6acnIk%2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x50%2FMAOHPsusGHeIyW5lYQf1T%2BQMUldzSNW74BcI2eQ7i8xJe9HTeKIfOeXenA71wMDpAsxggIeMIICGgIBATA1MCkxJzAlBgNVBAMTHkdhcmliYWxkaSBXSU4tOUhFODk2VlNUVTUgZ2RvaQIIG%2FEhaWPZpp8wCwYJYIZIAWUDBAIBoIG%2FMBIGCmCGSAGG%2BEUBCQIxBBMCMTcwGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAgBgpghkgBhvhFAQkFMRIEEOela95NoMpuws899AmoAWwwLwYJKoZIhvcNAQkEMSIEILhlDJ2R7j%2F4he%2Bs0dLwG082cqTQyBuxh2ctMexsKOLAMDwGCmCGSAGG%2BEUBCQcxLhMsWU9qQ1BydEZTaXRWcjhocHB0V3JsTjVLRnh3NnVYWUpzWThlRmZvR3JSdz0wCwYJKoZIhvcNAQEBBIIBAApfpHwqP%2FzcHqMuEm93Fnsrv76gpo6yBrysxwC2VkmVdBgL1LCe%2FAm%2BiH2KeBPRdjJur8phrrksbYMN4azXw3FCi1UqpuDURFbgftfTk3lq4iDboNpwn3R%2FqnKc4YqYDJ5egLFI2xR9iqRg0iXKEUJcT4eZww%2Fz4HCd6wor9MaBRWjjgyJZ0f2cT3mMeAx5VOhRNi9e%2BgUw%2BrMtCBZFQF9zIkEJkZ2qZqicVAnBqgN7e4FXgiVix3ShfARJgcMSsT89cU5ahMAvRl7m%2F6oip7gbdzUbTU%2FP%2FJqBDAI%2FBeL0wWQUm94nKWqD7Xrk%2B19NToTprbVlcHwjH4ctmQWMJao%3D

So those messages seem to decode fine in my configuration. It looks like I'm using a similar one as yours, though.

You could try adding more of these fmt.Println statements around https://github.com/micromdm/scep/blob/main/scep./scep.go#L226 and the other functions.

It might also be the case that the decryption fails, but I would expect a clear error message in that case.

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

3 participants