system: You are an expert security code reviewer. You will be shown a source code file along with a multi-select question listing several CWE (Common Weakness Enumeration) categories. Your task is to identify which of the listed CWEs are present in the code.

OUTPUT FORMAT: Respond with the letter(s) of all correct options, sorted alphabetically and comma-separated, wrapped in a single \boxed{...}. Examples: `\boxed{A}` for one correct, `\boxed{A,C}` for two, `\boxed{A,C,E}` for three. Output the boxed answer ONLY -- no explanation, no other text.

user: ```python
import tempfile
import threading
from functools import partial
from logging import getLogger
from pathlib import Path
from subprocess import Popen, PIPE, DEVNULL, STDOUT
from sys import platform as _platform
import requests
import re

from kivymd.toast import toast
from kivymd.uix.boxlayout import MDBoxLayout
from kivymd.uix.button import MDFlatButton
from kivymd.uix.dialog import MDDialog
from kivymd.uix.list import OneLineListItem

from tesseractXplore.app import get_app
from tesseractXplore.downloader import download_with_progress, switch_to_home_for_dl
from tesseractXplore.process_manager import create_threadprocess
from tesseractXplore.unix import run_cmd_with_sudo_dialog

logger = getLogger().getChild(__name__)

def reset_tesspaths():
    """ Reset tesspaths to default """
    sc = get_app().settings_controller
    sc.settings_dict['tesseract']['tesspath'] = ""
    sc.settings_dict['tesseract']['tessdatadir'] = ""
    sc.settings_dict['tesseract']['tessdatadir_system'] = ""
    sc.settings_dict['tesseract']['tessdatadir_user'] = ""
    sc.save_settings()

def install_tesseract_dialog():
    def close_dialog(instance, *args):
        instance.parent.parent.parent.parent.dismiss()
    layout = MDBoxLayout(orientation="horizontal", adaptive_height=True)
    layout.add_widget(OneLineListItem(text="Tesseract wasn't found on the system. You can install it now or set"
                                           "the right path in the settings-menu. (Restart required)"))
    dialog = MDDialog(title="Installing tesseract?",
                      type='custom',
                      auto_dismiss=False,
                      content_cls=layout,
                      buttons=[
                          MDFlatButton(
                              text="INSTALL", on_release=partial(install_tesseract)
                          ),
                          MDFlatButton(
                              text="DISCARD", on_release=close_dialog
                          ),
                      ],
                      )
    if get_app()._platform not in ['win32', 'win64']:
    # TODO: Focus function seems buggy in win
        dialog.content_cls.focused = True
    dialog.open()

def install_tesseract(instance):
    instance.parent.parent.parent.parent.dismiss()
    if _platform in ["win32", "win64"]:
        switch_to_home_for_dl()
        toast('Download: Tesseract installer\nThe app will be closed and the installer will be started automatically!')
        thread_install_tesseract_win()
    else:
        run_cmd_with_sudo_dialog(title="Enter sudo password to change the rights of the destination folder",func=thread_install_tesseract_unix)

def thread_install_tesseract_win():
    create_threadprocess("Prepare downloading tesseract", dl_install_tesseract_win)

def get_tesseract_winurl():
    try:
        s = requests.Session()
        r = s.get(get_app().settings_controller.tesseract['winurl'],
                    verify=False)
        htmltext = r.text.split('<p>The latest installers can be downloaded here:</p>\n<ul>\n<li>')[1].split('</li>\n</ul>')[0]
        res = re.findall(r'href="(.*)"\s', htmltext)
        if len(res) == 2:
            if _platform == "win32":
                return res[0]
            else:
                return res[1]
        else:
            raise Exception
    except:
        if _platform == "win32":
            return get_app().settings_controller.tesseract['win32url']
        else:
            return get_app().settings_controller.tesseract['win64url']

def dl_install_tesseract_win():
    try:
        url = get_tesseract_winurl()
        download_with_progress(url, Path(tempfile.gettempdir()).joinpath("tesseract.exe"), install_tesseract_win)
    except:
        toast('Download: Error')
        logger.info(f'Download: Error while downloading')

def install_tesseract_win(instance, *args):
    toast('Download: Succesful')
    logger.info(f'Download: Succesful')
    from os import startfile
    startfile(Path(tempfile.gettempdir()).joinpath("tesseract.exe"))
    reset_tesspaths()
    get_app().stop()

def thread_install_tesseract_unix(instance, *args):
    instance.parent.parent.parent.parent.dismiss()
    switch_to_home_for_dl()
    toast('Installing: Tesseract\nThe app will be closed after installation automatically!')
    th_install = threading.Thread(target=install_tesseract_unix, kwargs={'instance':instance})
    th_install.setDaemon(True)
    th_install.start()

def install_tesseract_unix(instance=None):
    install_tesseract = Popen(['sudo', '-S', 'apt-get', 'install', '-y', 'tesseract-ocr'],
                           stdin=PIPE)
    install_tesseract.stdin.write(bytes(instance.parent.parent.parent.parent.content_cls.children[0].text, 'utf-8'))
    install_tesseract.communicate()
    reset_tesspaths()
    get_app().stop()
    return
```

Which of the following CWE vulnerability categories are present in this code? Multiple options may be correct.

  A) CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
  B) CWE-1333: Inefficient Regular Expression Complexity
  C) CWE-732: Incorrect Permission Assignment for Critical Resource
  D) CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
  E) CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
  F) CWE-295: Improper Certificate Validation
Answer: F