บทความนี้นำเสนอการติดตั้ง Burp CA as a system-level บน android emulator เพื่อแก้ไขปัญหาในกรณีที่ application ไม่ได้ติด certificate pinning แต่ traffic ไม่วิ่งผ่าน burp ในระหว่างการทำ mobile penetration testing.
บทความโดย
jsontwenty4
Cyber Security Researcher
ขั้นตอนที่ 1: “Proxy” -> “Options” -> กด import / export CA certificate.

เลือก Certificate in DER format -> ตั้งชื่อไฟล์ cacert.der และกด export.

โปรแกรมจะขึ้นข้อความว่า “The certificate was successfully exported”.

ขั้นตอนที่ 2: ใช้ openssl ในการ convert DER to PEM โดยใช้คำสั่งด้านล่าง
openssl x509 -inform DER -in cacert.der -out cacert.pem openssl x509 -inform PEM -subject_hash_old -in cacert.pem |head -1 mv cacert.pem <hash>.0
ตัวอย่าง screenshot captured ดังรูปด้านล่าง

เมื่อ convert เสร็จสมบูรณ์ก็จะได้ไฟล์ที่มีชื่อว่า 9a5ba575.0
ขั้นตอนที่ 3: เปิด Andoird emulator ด้วยคำสั่งด้านล่าง
emulator -list-avds emulator -writable-system -no-snapshot-load -avd Test_API_28_x64
หากไม่สามารถใช้ 2 คำสั่งด้านบนได้ให้ทำการ set up environment variable “ANDROID_HOME” ก่อนโดยให้ชี้ location ไปที่ Andoird SDK Location ดังไฮไลท์กรอบสีแดงรูปด้านล่าง

ขั้นตอนที่ 4: เมื่อเปิด emulator เรียบร้อยแล้วให้ใช้คำสั่งด้านล่างเพื่อยัด certificate เข้าไปยัง android emulator as system-level. โดยทั่วไปแล้ว trusted CAs ทั้งหมดของ android จะถูกเก็บอยู่ที่ path “/system/etc/security/cacerts” ซึ่งจะต้องอาศัยสิทธิ์ root ในการทำ.
adb root adb remount adb push C:\Users\{user}\Desktop\9a5ba575.0 /system/etc/security/cacerts/ adb shell chmod 644 /system/etc/security/cacerts/9a5ba575.0
ตัวอย่าง screenshot captured ดังรูปด้านล่าง

หากทำการส่ง certificate ไปยัง andoird emulator เสร็จแล้วให้รีบูทเครื่อง 1 ครั้ง
adb reboot
เมื่อรีบูทเครื่องเสร็จเรียบร้อยแล้วให้เราทำการเช็ค Burp CA บน android emulator โดยเข้าไปดูที่ “Setting” -> “Security&Location” -> “Encryption&Credentials” -> “Trusted credentials” จะเห็นว่ามี “PortSwigger CA” เรียบร้อยแล้ว

Reference
https://blog.ropnop.com/configuring-burp-suite-with-android-nougat/