The results of reverse engineering an ADHD test app

Reverse Engineering My ADHD Test
https://nullpt.rs/reverse-engineering-adhd-test
Veritas had attributed her tendency to 'not stick with hobbies she started on a whim' to her personality, but after a friend was diagnosed with autism, she considered getting tested for ADHD.

When Veritas visited a psychiatrist, he was instructed to take an online ADHD test. Not knowing what would happen once the test started, Veritas clicked the 'Start Test' link that was sent to him via email, and was taken to a blank page with a screen that looked like an early 2000s Flash game. The task was simple: 'Press the space key when the 'Ace of Hearts' card with three red hearts appears,' and 'Do nothing otherwise.'

Although he pressed the spacebar as instructed, neither the timer nor the score was displayed; only a blinking card appeared. Soon, other clip art began to appear next to the card, as if to distract him, and eventually, sounds of a baby crying and police sirens started to mix in. Veritas felt as if the task would never end, and he just kept pressing the spacebar to try and get the endless test over.

Here is a portion of a recording of the ADHD test screen.
During the inspection, Veritas became curious and came up with the ingenious idea of 'getting all the page source code and submission requests,' so he opened DevTools while undergoing the inspection and saved all the page scripts. After the inspection was finished, he began investigating the saved scripts. First, he checked how pressing the spacebar was handled.
[code]
$(document).keyup(function (evt) {
keyPressed = false;
Context.LastPressTime = Context.CurrentTime;
if (evt.keyCode == 32 || evt.which == 32) {
Context.spacePressArray.clickTimes.push(adjustedTime);
console.log('Pushing Space: ' + Context.CurrentTime + ', Adjusted Time: ' + adjustedTime);
}
else if (evt.keyCode != 32 && evt.keyCode != 13 ) {
Context.spacePressArray.badClickTimes.push(adjustedTime);
console.log('Pushing Bad Press: ' + ', Adjusted Time: ' + adjustedTime);
}
}).keydown(function (evt) {
if (!keyPressed) {
adjustedTime = Context.CurrentTime - Context.Offset;
}
keyPressed = true;
})
[code]
Upon examining the code, it became clear that not only were spacebar presses being tracked, but also 'incorrect' key presses—keys other than the spacebar and Enter key. Veritas also discovered yet another hook.
[code]
onBlur = function (present_message){
present_message = (typeof present_message !== 'undefined' ? present_message : true);
if (!Context.canLooseFocus) {
Context.LastinFocusTime = Date.now();
InnerLog.log('Last in Focus Time: ' + Context.LastinFocusTime + ', Last Test Time in Focus: ' + Context.CurrentTime);
Context.InFocus = false;
adhd.prototype.addBeep();
if (present_message) {
this.outOfFocusAlert.htmlElement.style.visibility = 'visible';
}
}
};
$(window).focus(function () {
if (!Context.canLooseFocus) {
this.outOfFocusAlert.htmlElement.style.visibility = 'hidden';
Context.LostFocusAggregateTime += (Date.now() - Context.LastinFocusTime);
Context.InFocus = true;
Context.spacePressArray.lostFocusAggregateTime = Context.LostFocusAggregateTime;
adhd.prototype.removeBeep();
InnerLog.log('Aggregate Not in Focus Time: ' + Context.LostFocusAggregateTime + ', at: ' + Context.CurrentTime);
if (Context.LostFocusAggregateTime < 0 || Context.CurrentTime < 0 || Context.startTime < 0) {
alert(Context.MessageSomethingWentWrong);
}
}
});
[code]
The code above detects when the inspection app loses focus, such as when a new tab is opened.
Interestingly, we also found that the assets switched depending on whether the subject was an adult or a child. Children were limited to 15 FPS, while adults were limited to 24 FPS. Additionally, children heard bird sounds, bowling sounds, saber sounds, and airplane sounds, while adults heard baby crying, car crash sounds, and police sirens.
[code]
if (ageGroup == 'adults') {
properties = lib.properties_adults;
}
else {
properties = lib.properties_children;
}
[code]
[code]
lib.properties Freechildren = {
width: 800,
height: 600,
fps: 15
color: ' #666666'
manifest: [
{src:'/js/adhd-html5/sounds/Birds.mp3', id:'Birds'},
{src:'/js/adhd-html5/sounds/Jedi.mp3', id:'Jedi'},
{src:'/js/adhd-html5/sounds/Bowling.mp3', id:'Bowling'},
{src:'/js/adhd-html5/sounds/Gong.mp3', id:'Gong'},
{src:'/js/adhd-html5/sounds/Plane.mp3', id:'Plane'},
{src:'/js/adhd-html5/sounds/Plane68.mp3', id:'Plane68'},
{src:'/js/adhd-html5/sounds/SaberSmall.mp3', id:'SaberSmall'},
{src:'/js/adhd-html5/sounds/PlaneBoom105.mp3', id:'PlaneBoom105'},
{src:'/js/adhd-html5/sounds/SaberOff3.mp3', id:'SaberOff3'},
{src:'/js/adhd-html5/sounds/Saber111.mp3', id:'Saber111'},
{src:'/js/adhd-html5/sounds/Saber111copy.mp3', id:'Saber111copy'},
{src:'/js/adhd-html5/sounds/Saber211.mp3', id:'Saber211'},
{src:'/js/adhd-html5/sounds/Saber211copy.mp3', id:'Saber211copy'},
{src:'/js/adhd-html5/sounds/Saber33.mp3', id:'Saber33'},
{src:'/js/adhd-html5/sounds/Saber33copy.mp3', id:'Saber33copy'},
{src:'/js/adhd-html5/sounds/SaberOnLong3.mp3', id:'SaberOnLong3'},
{src:'/js/adhd-html5/sounds/SaberOnLong3copy.mp3', id:'SaberOnLong3copy'},
{src:'/js/adhd-html5/sounds/beep-01a.mp3', id:'Beep'}
]
};
[code]
[code]
lib.properties_adults = {
width: 800,
height: 600,
fps: 24
color: '#999999',
manifest: [
{src:'/js/adhd-html5/sounds/arsp018wav.mp3', id:'arsp018wav'},
{src:'/js/adhd-html5/sounds/assp022wav.mp3', id:'assp022wav'},
{src:'/js/adhd-html5/sounds/assp023wav.mp3', id:'assp023wav'},
{src:'/js/adhd-html5/sounds/babyCry.mp3', id:'babyCry'},
{src:'/js/adhd-html5/sounds/car_brakes.mp3', id:'BIKE2WAV'},
{src:'/js/adhd-html5/sounds/bottle_pop_2.mp3', id:'bottle_pop_2'},
{src:'/js/adhd-html5/sounds/carbrake01wav.mp3', id:'carbrake01wav'},
{src:'/js/adhd-html5/sounds/chsp016wav.mp3', id:'chsp016wav'},
{src:'/js/adhd-html5/sounds/copcar.mp3', id:'copcar'},
{src:'/js/adhd-html5/sounds/DogBarking02wav.mp3', id:'DogBarking02wav'},
{src:'/js/adhd-html5/sounds/flasher_coat_mono.mp3', id:'flasher_coat_mono'},
{src:'/js/adhd-html5/sounds/pouringliquid1.mp3', id:'pouringliquid1'},
{src:'/js/adhd-html5/sounds/arguing_couple.mp3', id:'arguing_couple'},
{src:'/js/adhd-html5/sounds/barking_dog.mp3', id:'barking_dog'},
{src:'/js/adhd-html5/sounds/police_car.mp3', id:'police_car'},
{src:'/js/adhd-html5/sounds/baby_crying.mp3', id:'baby_crying'},
{src:'/js/adhd-html5/sounds/smoking.mp3', id:'smoking'},
{src:'/js/adhd-html5/sounds/beep-01a.mp3', id:'Beep'}
]
};
[code]
The final compiled data only included 'when the spacebar was pressed,' 'when the wrong key was pressed,' and 'the total time the window was out of focus,' and the scoring model could not be found in the source code. After looking around the official website of the testing app, it appears that the scoring method is based on the following four attention indicators.
• Attentiveness (A) : The ability to evaluate and respond to stimuli as instructed; affects individuals who have difficulty paying attention or noticing specific details.
• Timeliness (T) : The ability to respond correctly within a given time frame. This affects individuals who have difficulty responding promptly to environmental changes or completing time-limited tasks.
• Impulsiveness (I) : This refers to the tendency to react immediately when something is 'forbidden,' and to act impulsively without considering the situation or the consequences of one's actions.
• Hyper-Reactivity (H) : Difficulty efficiently adjusting motor output or refraining from unnecessary actions, involving excessive, inaccurate, or undesirable responses.
The test results were so far outside the normal range that a psychiatrist asked him, 'Have you ever tried to cheat on an exam?' possibly because he had opened DevTools in preparation for reverse engineering. After denying the allegations, Veritas was scheduled to take a retest. During the retest, he said he made sure to maintain his concentration and avoid repeatedly pressing the spacebar.
After the re-examination, I wondered, 'How is this test evaluated from a psychiatrist's perspective?' and while examining the source code in more detail, I found an interesting function.
[code]
function sendParentReportToClinic(testId) {
var clinicEmail = $('#clinicEmail').val();
var data = {'test_id': testId, 'clinic_email': clinicEmail};
$.ajax( {
type: 'POST',
async: true,
dataType: 'json',
data: data,
url: location.protocol + '//' + location.host + '/api/tests/send_parent_report',
success: function (data) {
alert(data.data);
},
error: function(error) {
var errorText = $.parseJSON(error.responseText).message;
alert(userText);
}
});
}
[code]
The function described above sends test results to the clinic, and requires only two parameters: the clinic's email address and the test ID. Veritas reasoned that if the backend processing was poor, it would be possible to specify any email address as the clinic's address and enter one's own test ID (or any other test ID) to send the report to oneself. So, he converted the request into a cURL command and tried it out.
[code]
curl -X POST 'https://adhd-test/api/tests/send_parent_report' \
-H 'Accept: application/json' \
--data-urlencode 'test_id=1010101' \
--data-urlencode '[email protected]'
[code]
When the command was executed, the response contained the HTML of the login page, not a report. When the endpoint was accessed in a browser, a sign-up button was displayed. Only basic information such as email address, password, name, and phone number was required to sign up. Since the provider had made it possible to create a trial account for testing the product, veritas signed up for the trial and went to the dashboard.
During the trial, Veritas was able to take two free tests, so he devised a verification plan. The first test involved repeatedly pressing the space key, just like the initial test, and the second test involved taking the test normally, just like the retest. After registering himself as the client 'Null Ptr' and sending a test invitation, he executed the plan as intended. The report immediately appeared on the dashboard and was ready to be reviewed.

The results of a test involving repeatedly pressing the spacebar indicated 'low reliability' in the report, explaining why the psychiatrist suspected misconduct. Furthermore, the comparison graph with standard values clearly showed that something was amiss.

The results of the standard testing and verification were generally normal, and there were no issues regarding reliability.

While the results generally matched standard values, the only notable finding was that the student's impulsivity was judged to be higher than average.

The report concluded with the following summary:
According to comparisons to age and gender matched norms a significant deviation from the norm was detected in Null Ptr's I performance. This performance pattern may indicate attentional difficulties, and taken together with other findings, an increased likelihood for the existence of ADHD.
In other words, the diagnostic model compared Veritas's behavior to age- and gender-matched baseline values and predicted that he likely had ADHD based on his high level of impulsivity.
While waiting for the official test results from my follow-up appointment with the psychiatrist, I also had my friend Haze take the same test.

After holding down the spacebar for 18 minutes, my friend was judged to be 'normal' as follows:
According to the norm comparison table there is a low probability that Haze. has attention difficulties.
During a follow-up appointment, Veritas was diagnosed with ADHD by a psychiatrist and told that she had high impulsivity. She expressed surprise and regret that she should have realized it sooner. While acknowledging that the ADHD diagnosis doesn't explain all her behavior, she says it helps her understand her own actions.
The blog concludes with a photograph of the moon taken with a telescope, a hobby that Veritas spontaneously took up.

Related Posts:
in Software, Web Service, Posted by log1c_sh







