2 min read

How I Hacked My Apartment Building

Last updated on Jan 10, 2025

TL;DR: Built an app with Twilio that responds with an audio recording of a dial tone

Building


The intercom machine at my building allows visitors to dial the apartment owner in order to unlock the lobby door.

The issue with this machine is that it only allows one phone number to be programmed to it per apartment. This is problematic because I live with two other roommates.

In the spirit of home automation, I wanted to have the ability to get into my apartment without my wallet/phone. So what did I do? I hacked it!

The way the intercom works is that you dial the apartment owner and once the person answers they have to dial the number 6 to unlock the door for the visitor.

I created a simple Sinatra app that uses the Twilio API. When the number (assigned by Twilio) is called, it sends a Webhook to the server and it responds with an audio recording. The audio recording is of the dial tone that the intercom needs in order to allow it to unlock the door.

Here is a video of it in action.

Play

The code is straight forward too:

require 'rubygems'
require 'sinatra'
require 'twilio-ruby'
require './env' if File.exists?('env.rb')

account_sid = ENV['ACCOUNT_SID']
auth_token  = ENV['AUTH_TOKEN']

Twilio.configure do |config|
  config.account_sid = account_sid
  config.auth_token = auth_token
end

get "/" do
  "Hello world"
end

get '/incoming-call' do
  # send text
    content_type 'text/xml'
    "<Response><Play>#{ENV['AUDIO_URL']}</Play></Response>"
end

I’ve open sourced the code, so you can check it out here.

PS: I removed this hack from my building after this post. I don’t want to put my neighbors at risk of such a security flaw. :)