How to extract certificates from the Windows registry

0 27
The Windows registry contains binary blocks (Blobs), some of which are used to s...

The Windows registry contains binary blocks (Blobs), some of which are used to store certificates, as shown below:How to extract certificates from the Windows registry

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SystemCertificates

HKEY_CURRENT_USER\SOFTWARE\Microsoft\SystemCertificates

Certificate through DERFormat is encoded, always starting with 0x30. However, it can be found that the binary block found in the registry does not start with 0x30, because the certificate prefix stores some metadata. Search for 0x30 to find the location of the certificate:

Not all byte sequences starting with 0x30 are valid certificates. Search from 0x30 8 and extract the byte sequence until the end of the binary block to find the certificate.

This method is not accurate, and it can be found by viewing several binary blocks: each certificate starts with a 4-byte prefix, which encodes the length of the certificate (in little-endian order), and then this length field is preceded by an unchanging 8-byte prefix: 20 00 00 00 01 00 00 00.

appears to be TLVformat, each certificate's type is 20 00 00 00 01 00 00 00. The tool format-bytes.pyis a tool for parsing binary data, which can be used to parse TLV records, as follows:

<QIin <Represents little-endian order,QRepresents unsigned long long (8 bytes),IRepresents unsigned int (4 bytes).t:0This means that the type field is the first field.l:1This means that the length field is the second field.

It can be seen that this binary block contains 11 TLV records, the last one has a length of 1239 and contains the certificate type 0x100000020L.

Further researchIndicatesThe type field is actually composed of two fields: the attribute identifier field and the reserved field, both of which are four bytes. Possible values for the attribute identifier can be found in Windows Developer Centerand found in the wincrypt.h header file.

This means that the TLV records within the binary block can be format-bytes.py -f "tlv=f:<III,t:0,l:2" blob.binPerform analysis:

For example, the type of record 5 is 0x0b, representing CERT_FRIENDLY_NAME_PROP_ID:

As shown in the figure above, it includes the issuer name encoded in UTF16. As shown below, the certificate itself is located within record 11 (type 0x20):

To extract the certificate, please use -dExecute binary dump and write to a local file:

Conclusion

TLV records often appear in binary data blocks. If you want to identify data in binary blocks, comparing several examples may help you find the defined pattern. Certificates and metadata are stored together in the registry, and the metadata structure is the TrLV record. The certificate itself is stored inside the record, with a type of 0x20.

Reference Source

NVISO

你可能想看:

d) Adopt identification technologies such as passwords, password technologies, biometric technologies, and combinations of two or more to identify users, and at least one identification technology sho

Distributed Storage Technology (Part 2): Analysis of the architecture, principles, characteristics, and advantages and disadvantages of wide-column storage and full-text search engines

As announced today, Glupteba is a multi-component botnet targeting Windows computers. Google has taken action to disrupt the operation of Glupteba, and we believe this action will have a significant i

It is possible to perform credible verification on the system boot program, system program, important configuration parameters, and application programs of computing devices based on a credible root,

5. Collect exercise results The main person in charge reviews the exercise results, sorts out the separated exercise issues, and allows the red and blue sides to improve as soon as possible. The main

2.8 Continue to click the getTomcatWebServer method, find the initialize () method, and you can see the tomcat.start () method to start the Tomcat service.

b) It should have the login failure handling function, and should configure and enable measures such as ending the session, limiting the number of illegal logins, and automatically exiting when the lo

2. First filter out educational sites from the imported text, and do not perform friend link crawling

In today's rapidly developing digital economy, data has become an important engine driving social progress and enterprise development. From being initially regarded as part of intangible assets to now

b) It should have a login failure handling function, and should configure and enable measures such as ending the session, limiting the number of illegal login attempts, and automatically logging out w

最后修改时间:
admin
上一篇 2025年03月29日 18:04
下一篇 2025年03月29日 18:26

评论已关闭