惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Hacker News: Ask HN
Hacker News: Ask HN
H
Help Net Security
Microsoft Azure Blog
Microsoft Azure Blog
B
Blog RSS Feed
Jina AI
Jina AI
Stack Overflow Blog
Stack Overflow Blog
量子位
博客园_首页
Vercel News
Vercel News
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Forbes - Security
Forbes - Security
IT之家
IT之家
N
News and Events Feed by Topic
S
Security Affairs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Webroot Blog
Webroot Blog
Recorded Future
Recorded Future
L
LangChain Blog
Y
Y Combinator Blog
AI
AI
MyScale Blog
MyScale Blog
大猫的无限游戏
大猫的无限游戏
小众软件
小众软件
Know Your Adversary
Know Your Adversary
AWS News Blog
AWS News Blog
Help Net Security
Help Net Security
Cyberwarzone
Cyberwarzone
L
Lohrmann on Cybersecurity
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Google Online Security Blog
Google Online Security Blog
V2EX - 技术
V2EX - 技术
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
PCI Perspectives
PCI Perspectives
I
Intezer
T
Tenable Blog
G
Google Developers Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
T
Troy Hunt's Blog
L
LINUX DO - 最新话题
云风的 BLOG
云风的 BLOG
C
CXSECURITY Database RSS Feed - CXSecurity.com
有赞技术团队
有赞技术团队
O
OpenAI News
P
Proofpoint News Feed
TaoSecurity Blog
TaoSecurity Blog
C
Check Point Blog
Last Week in AI
Last Week in AI
S
Schneier on Security
Simon Willison's Weblog
Simon Willison's Weblog
Blog — PlanetScale
Blog — PlanetScale

Homepage on Aditya Telange

One Year with evil-winrm-py - A Retrospective Bypassing LinkedIn's Connection Privacy with a Simple Search Filter Making Dynamic Instrumentation Accessible with Frida UI Breaking Payload Encryption in Web Applications HackTheBox (HTB) - Escape HackTheBox (HTB) - Resolute HackTheBox (HTB) - Certified State of VMWare Workstation (Pro?) on Linux Android App Security Testing Lab with MobSleuth Android phone as a Webcam on Linux Breaking down Reverse shell commands HackTheBox (HTB) - Photobomb Primer on HTTP Security Headers Image Zoom-In effect with HUGO HackTheBox (HTB) - Legacy HackTheBox (HTB) - Lame Cryptohack - Keyed Permutations [5 pts] Cryptohack - Resisting Bruteforce [10 pts] Cryptohack - RSA Starter 1 [10 pts] Cryptohack - Base64 [10 pts] Cryptohack - Bytes and Big Integers [10 pts] Cryptohack - Hex [5 pts] Cryptohack- XOR Starter [10 pts] HackTheBox (HTB) - Horizontall HackTheBox (HTB) - Forge HackTheBox (HTB) - Previse HackTheBox (HTB) - BountyHunter HackTheBox (HTB) - Explore HackTheBox (HTB) - Cap HackTheBox (HTB) - Pit HackTheBox (HTB) - Knife HackTheBox (HTB) - Love HackTheBox (HTB) - Tenet HackTheBox (HTB) - Ready Watermarking images with HUGO My Github Project went viral! Cryptohack - ASCII [5 pts] Cryptohack - Finding Flags [2 pts] Cryptohack - Great Snakes [3 pts] Cryptohack - JWT Sessions [10 pts] Cryptohack - Network Attacks [5 pts] Cryptohack - Token Appreciation [5 pts] CAF's Android for MSM Basic Website Analytics with Vercel Github Actions as Temporary File Sharing Platform Addition of prebuilt APK - AOSP Rom Development External Link With target='_blank' in Hugo Markdown Setting Up Build Environment - AOSP Rom Development Getting Started - AOSP Rom Development Using Secure HTTP Headers with Vercel/Zeit Education and Certifications Link Tree ↟ | Aditya Telange Personal Projects Resume - Aditya Telange Security Acknowledgements About Me Graph View License Privacy Policy
Merging AOSP Security Patches into Custom ROMs
[Aditya Telange](https://x.com/adityatelange) · 2023-01-28 · via Homepage on Aditya Telange

Introduction

Google publishes Android Security Bulletin (ASB) on the first Monday of each month where they list details of security vulnerabilities affecting Android devices. 1

This bulletin mentions a Security patch level YYYY-MM-01 or YYYY-MM-05. These are the dates on which the patches are tagged 2! Read more on How Monthly Android Security Patch Updates Work by XDA.

Android Security patch level is mentioned in the Settings -> About Phone section.

Now, AOSP has a ton of repositories 3 that get downloaded when we do repo sync 4. These projects are present inside the manifest. You can browse them all here https://github.com/orgs/aosp-mirror/repositories.

After the platform fixes(patches) are merged into AOSP, these security-related patches are tagged with the prefix android-security-12.0.0_rXY (with X and Y being the versioning in incrementing order).

Example: Tag android-security-12.0.0_r43 on repo platform_build. https://github.com/aosp-mirror/platform_build/releases/tag/android-security-12.0.0_r43

Most of the custom roms projects maintain a forked version of these repositories to customize them. These security patches are then pulled into their respective forks. After all the security patches are merged, the Security String is updated to the corresponding Security patch level mentioned in ASB.

The security patch level is present in platform/build/core/version_defaults.mk inside a variable PLATFORM_SECURITY_PATCH.

Take a look at this commit history for LineageOS: Update Security String to YYYY-MM-DD

Manual way of merging security patches

So now that we know how the whole things work, we now have to get these security patches merged from AOSP into our own (forked) source.

Assuming you know how to sync sources, we first sync the clean AOSP source as it is using Downloading the Source | Android Open Source Project.

Then perform the following setups to get security patches from android-security-12.0.0_r43 and the version we are currently patched with android-security-12.0.0_r42:

  1. We sync last month’s AOSP tag or tag on which we have already patched previously.

    • Suppose we want to merge android-security-12.0.0_r43 released in January 2023,
    • We sync android-security-12.0.0_r42.
    • repo init -u https://android.googlesource.com/platform/manifest \
        -b android-security-12.0.0_r42 --depth=1
      
    • repo sync --force-sync --current-branch --no-clone-bundle \
        --optimized-fetch --prune -j$(nproc --all)
      
  2. Fetch the presnt month’s tag/latest tag.

    • We use repo forall
    • repo forall -p -c 'git fetch aosp android-security-12.0.0_r43'
      
  3. Diff the commits/commit hash and save it in a file.

    • repo forall -p -c 'git log --oneline HEAD..FETCH_HEAD' \
        > 12.0.0_r42-to-12.0.0_r43.diff.txt
      
    • The commit hashes will be present in file 12.0.0_r42-to-12.0.0_r43.diff.txt
  4. Cherry-pick these commits into specific repos.

    • For project frameworks/base if we have a fork, we will cherry-pick the above-mentioned commits.
    • If we are dealing with CAF based ROMs such as AOSPA (paranoidandroid) we will clone the repo/project from CAF and then cherry-pick the above mentioned commits from AOSP.
    • As an example, we can see that LineageOS Team has done the same: https://review.lineageos.org/q/topic:S_asb_2023-01
  5. Done! We have added all the security patches to our sources. And ready to ship it with the next release.

✅ We can now add a new commit to android_build/core/version_defaults.mk updating the security patch level string against variable PLATFORM_SECURITY_PATCH and add message as Bump Security String to 2023-01-05.


Credits: